         }
 
         if operations.contains(.update) {
+            let updatedObjectIDs = Array(remotePrimaryKeysSet.intersection(localPrimaryKeysSet))
+
             for fetchedID in updatedObjectIDs {
                 let JSON = remotePrimaryKeysAndChanges[fetchedID]!
                 let objectID = primaryKeysAndObjectIDs[fetchedID]!

        }

        if operations.contains(.insert) {
            for fetchedID in insertedObjectIDs {
                let objectDictionary = remotePrimaryKeysAndChanges[fetchedID]!
                inserted(objectDictionary)

            remotePrimaryKeysAndChanges[primaryKey] = change
        }

        let remotePrimaryKeysSet = Set(remotePrimaryKeysWithoutNils)
        let localPrimaryKeysSet = Set(localPrimaryKeys)

        if operations.contains(.delete) {
            let deletedObjectIDs = Array(localPrimaryKeysSet.subtracting(remotePrimaryKeysSet))

            for fetchedID in deletedObjectIDs {
                let objectID = primaryKeysAndObjectIDs[fetchedID]!
                let object = context.object(with: objectID)
