newValues = ERXUtilities.localInstancesOfObjects(_eo.editingContext(), newValues);
newValues = ERXEOControlUtilities.localInstancesOfObjects(_eo.editingContext(), newValues);
    public void updateSourceObject(NSArray newValues) {        // If no selections are choosen then newValues is null.        newValues = newValues != null ? newValues : NSArray.EmptyArray;        String masterKey = _localRelationshipKey();        Object aSourceObject = _localSourceObject();        boolean isDictionary = (aSourceObject instanceof NSMutableDictionary);        NSMutableDictionary _dictionary = (isDictionary) ? (NSMutableDictionary)aSourceObject : null;        EOEnterpriseObject _eo = !(isDictionary) ? (EOEnterpriseObject)aSourceObject : null;        newValues = ERXUtilities.localInstancesOfObjects(_eo.editingContext(), newValues);        // Need to handle the keyPath situation.        if (_eo != null && masterKey.indexOf(".") != -1) {            String partialKeyPath=ERXStringUtilities.keyPathWithoutLastProperty(masterKey);            _eo = (EOEnterpriseObject)_eo.valueForKeyPath(partialKeyPath);            masterKey = ERXStringUtilities.lastPropertyKeyInKeyPath(masterKey);        }        NSArray currentValues = (NSArray)NSKeyValueCodingAdditions.Utility.valueForKeyPath(_eo, masterKey);        NSMutableArray mutableCurrentValues;        if(currentValues instanceof NSMutableArray) {            mutableCurrentValues = (NSMutableArray)currentValues;        } else {            mutableCurrentValues = currentValues.mutableClone();            NSKeyValueCodingAdditions.Utility.takeValueForKeyPath(_eo, mutableCurrentValues, masterKey);        }        int count = mutableCurrentValues.count();        EOEnterpriseObject o;        for (int i = count - 1; i >= 0; i--) {            o = (EOEnterpriseObject)mutableCurrentValues.objectAtIndex(i);            if ((null==newValues) || (newValues.indexOfIdenticalObject(o) == NSArray.NotFound)) { // not found                if (isDictionary) {                    mutableCurrentValues.removeObject(o);                }                else {                    _eo.removeObjectFromBothSidesOfRelationshipWithKey(o, masterKey);                }            }        }        count = newValues.count();        if ((isDictionary) && (mutableCurrentValues==null)) {            mutableCurrentValues = new NSMutableArray(count);            _dictionary.setObjectForKey(currentValues, masterKey);        }        for (int i = count - 1; i >= 0; i--) {            o = (EOEnterpriseObject)newValues.objectAtIndex(i);            if ((null==mutableCurrentValues) || (mutableCurrentValues.indexOfIdenticalObject(o) == NSArray.NotFound)) {  // not found                if (isDictionary) {                    mutableCurrentValues.addObject(o);                } else {                    _eo.addObjectToBothSidesOfRelationshipWithKey(o, masterKey);                }            }        }    }