ERXGenericRecord.checkMatchingEditingContexts(object, key, newValueEO);
//object._superTakeValueForKey(value, key);
if (newValueEO.isToManyKey(inverse)) {
NSArray inverseOldValues = (NSArray) newValueEO.valueForKey(inverse);
if (inverseOldValues == null || !inverseOldValues.containsObject(object)) {
boolean oldUpdateInverseRelationship = newValueEO._setUpdateInverseRelationships(false);
try {
newValueEO.addObjectToPropertyWithKey(object, inverse);
}
finally {
newValueEO._setUpdateInverseRelationships(oldUpdateInverseRelationship);
}
}
}
else {
EOEnterpriseObject inverseOldValue = (EOEnterpriseObject) newValueEO.valueForKey(inverse);
if (inverseOldValue != object) {
boolean oldUpdateInverseRelationship = newValueEO._setUpdateInverseRelationships(false);
try {
newValueEO.takeStoredValueForKey(object, inverse);
}
finally {
newValueEO._setUpdateInverseRelationships(oldUpdateInverseRelationship);
}
}
}
}
// If the object is a null, we need to perform the equivalent of
// an removeObjectFromBothSidesOfRelationshipWithKey
else {
//object._superTakeValueForKey(null, key);
if (oldValueEO != null) {
if (oldValueEO.isToManyKey(inverse)) {
NSArray inverseOldValues = (NSArray) oldValueEO.valueForKey(inverse);
if (inverseOldValues != null && inverseOldValues.containsObject(object)) {
boolean oldUpdateInverseRelationship = oldValueEO._setUpdateInverseRelationships(false);
try {
oldValueEO.removeObjectFromPropertyWithKey(object, inverse);
}
finally {