long fieldValue = -1;
if (value instanceof Persistable)
value = ((Persistable) value).getId();
if (value instanceof ObjectId) {
ObjectId id = (ObjectId) value;
id.persistIfNeeded(id.isPersisted() ? null
: recordNewObject((ObjectId) value, convertToObjectId(referrer))); // persist into Object if we need to persist
if (id.source instanceof DynaObjectDBSource && id.subObjectId != null && !"".equals(id.subObjectId)) {
fieldType = OBJECT_TYPE;
fieldValue = ((DynaObjectDBSource) id.source).convertId(id.subObjectId);
} else