Nil out targetObjectID if targetObject is set to an unmanaged object

In particular, if the user sets targetObject to nil (as is advised for multiple root objects) then targetObjectId should also be nil.