FieldDescriptor field = findItemStateField(msg.getDescriptorForType());
if (field == null) {
throw new IllegalStateException();
}
ItemStateData itemStateData;
try {
itemStateData = (ItemStateData) builder.getField(field);
} catch (Exception e) {
throw new IllegalArgumentException("Error reading item state field", e);
}
if (itemStateData.hasDeletedAt()) {
throw new IllegalStateException();
}
ItemStateData.Builder b = ItemStateData.newBuilder(itemStateData);
b.setDeletedAt(Clock.getTimestamp());