public Model add(RuntimeModel model) {

    if (!getType().equals(model.getNativeType())) {
      throw new IllegalArgumentException();
    }

    final ObservableMap<Integer, Model> hashCodeMap = getHashCodeMap();
    hashCodeMap.put(model.hashCode(), model);

    final ModelHeapShardEvent event = new ModelHeapShardEvent(this);
    event.setModel(model);
    fireEvent(ModelHeapShardEventName.modelAdded, event);

    // Check to see if the model has an id set on it already
    final URI heapId = model.getHeapId();

    Model finalModel = model;
    if (heapId != null) {
      // Technically we just identified this model
      finalModel = modelIdentified(model, heapId, event);
    }

    finalModel.addEventListener(_HeapModelEventListener);
    return finalModel;
  }
 public void onFieldValueChanged(FieldEvent fieldEvent) {
   final String idFieldName = FieldNames.Document.id.name();
   if (idFieldName.equals(fieldEvent.getFieldName())) {
     final RuntimeModel model = (RuntimeModel) fieldEvent.getModel().getDynamicInterface();
     final URI heapId = model.getHeapId();
     if (heapId != null) {
       final ModelHeapShardEvent modelHeapShardEvent =
           new ModelHeapShardEvent(ModelHeapShard.this);
       modelHeapShardEvent.setModel(model);
       modelIdentified(model, heapId, modelHeapShardEvent);
     }
   }
 }