ObjectContext objectContext = getObjectContext();
Class<?> clazz = extConfig.getEntityClass();
Object entity = id != null
? this.getEntity(objectContext, clazz, id)
: this.getEntity(objectContext, clazz, key, value);
ModelInstance model = new ModelInstance(extConfig, entity);
objectContext.deleteObjects(entity);
objectContext.commitChanges();
return model;
}