     }
     
     func mergeItems(items: [Item]) {
-        //TODO: create 2 delta arrays instead of iterating over all items twice
         let existingItems = self.mutableSetValueForKey("items")
+        removeMissingItems(items, from: existingItems)
+        addNewItems(items, to: existingItems)
+    }
+    
+    func removeMissingItems(items: [Item], from existingItems: NSMutableSet) {
         for item in existingItems {
             if let managedItem: ManagedItem = item as? ManagedItem {
                 if !contains(items, managedItem.item) {

    
    deinit {
        if let box = _box {
            box.removeObserver(self, forKeyPath: "title")
            box.removeObserver(self, forKeyPath: "items")
        }
    }

}

                }
            }
        }
    }
    
    func addNewItems(items: [Item], to existingItems: NSMutableSet) {
        for item in items {
            let itemIsInExistingItems = contains(existingItems, { (existingItem: AnyObject) -> Bool in
                let managedItem = existingItem as ManagedItem
