// Find the ObjectProvider for the element
Object elementToRemove = element;
ExecutionContext ec = op.getExecutionContext();
if (ec.getApiAdapter().isDetached(element)) {// User passed in detached object to collection.remove()! {
// Find an attached equivalent of this detached object (DON'T attach the object itself)
elementToRemove = ec.findObject(ec.getApiAdapter().getIdForObject(element), true, false, element.getClass().getName());
}
ObjectProvider elementOP = ec.findObjectProvider(elementToRemove);
// Check for change of owner of the element (removed from this but added to another one maybe?)
if (MetaDataUtils.isOwnedRelation(ownerMemberMetaData, storeMgr)) {