                 self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
                 
             case .Move(let indexPath, let newIndexPath, let changes):
-                //            // technique 1
-                //            tableView.deleteRowsAtIndexPaths([indexPath],
-                //                withRowAnimation: UITableViewRowAnimation.Fade)
-                //            tableView.insertRowsAtIndexPaths([newIndexPath],
-                //                withRowAnimation: UITableViewRowAnimation.Fade)
-                // technique 2
+//                // Technique 1 (replace)
+//                //
+//                // TODO: fix crash
+//                //
+//                //      BEFORE [["id": 6, "position": 3], ["id": 5, "position": 5], ["id": 14, "position": 6], ["id": 1, "position": 9], ["id": 7, "position": 11], ["id": 9, "position": 15], ["id": 12, "position": 19], ["id": 4, "position": 22]]
+//                //      DELETED FROM index 1
+//                //      DELETED FROM index 3
+//                //      INSERTED AT index 3
+//                //      MOVED FROM index 6 TO index 1 WITH CHANGES: ["position": 10]
+//                //      DELETED FROM index 7
+//                //      DELETED FROM index 8
+//                //      DELETED FROM index 9
+//                //      DELETED FROM index 10
+//                //      DELETED FROM index 11
+//                //      DELETED FROM index 12
+//                //      MOVED FROM index 13 TO index 0 WITH CHANGES: ["position": 20]
+//                //      INSERTED AT index 5
+//                //      DELETED FROM index 14
+//                //      MOVED FROM index 2 TO index 6 WITH CHANGES: ["position": 4]
+//                //      DELETED FROM index 15
+//                //      MOVED FROM index 5 TO index 7 WITH CHANGES: ["position": 9]
+//                //      AFTER [["id": 19, "position": 0], ["id": 3, "position": 1], ["id": 2, "position": 2], ["id": 4, "position": 5], ["id": 1, "position": 7], ["id": 7, "position": 14], ["id": 13, "position": 15], ["id": 10, "position": 21]]
+//                self.tableView.deleteRowsAtIndexPaths([indexPath],
+//                    withRowAnimation: UITableViewRowAnimation.Fade)
+//                self.tableView.insertRowsAtIndexPaths([newIndexPath],
+//                    withRowAnimation: UITableViewRowAnimation.Fade)
+                
+                // Technique 2 (move & update)
+                //
+                // TODO: fix crash
+                //
+                //      BEFORE [["id": 16, "position": 2], ["id": 11, "position": 3], ["id": 9, "position": 6], ["id": 2, "position": 8], ["id": 21, "position": 9], ["id": 15, "position": 11], ["id": 22, "position": 12], ["id": 5, "position": 13], ["id": 1, "position": 17], ["id": 18, "position": 22]]
+                //      INSERTED AT index 1
+                //      INSERTED AT index 2
+                //      INSERTED AT index 3
+                //      DELETED FROM index 1
+                //      INSERTED AT index 4
+                //      DELETED FROM index 3
+                //      MOVED FROM index 0 TO index 6 WITH CHANGES: ["position": 1]
+                //      MOVED FROM index 4 TO index 0 WITH CHANGES: ["position": 13]
+                //      MOVED FROM index 2 TO index 7 WITH CHANGES: ["position": 6]
+                //      INSERTED AT index 8
+                //      DELETED FROM index 6
+                //      INSERTED AT index 9
+                //      DELETED FROM index 7
+                //      INSERTED AT index 10
+                //      UPDATED AT index 5 WITH CHANGES: ["position": 15]
+                //      AFTER [["id": 21, "position": 1], ["id": 2, "position": 5], ["id": 20, "position": 6], ["id": 6, "position": 9], ["id": 23, "position": 10], ["id": 13, "position": 12], ["id": 10, "position": 15], ["id": 7, "position": 16], ["id": 1, "position": 18], ["id": 3, "position": 19], ["id": 4, "position": 21]]
                 let cell = self.tableView.cellForRowAtIndexPath(indexPath)
                 self.tableView.moveRowAtIndexPath(indexPath, toIndexPath: newIndexPath)
                 if !changes.isEmpty, let cell = cell {

            }
        }
        
        // Callback when all events have been applied
        fetchedRecordsController.didChange { [unowned self] in
            self.tableView.endUpdates()
        }
        
        // Compare two persons. Returns true if controller should emit a .Move or
        // .Update event instead of a deletion/insertion.

        
        // The fetched objects
        let fetchRequest = Person.filter(Col.visible).order(Col.position, Col.firstName, Col.lastName)
        fetchedRecordsController = FetchedRecordsController(dbQueue, fetchRequest)
        
        fetchedRecordsController.willChange { [unowned self] in
            // Events are about to be applied
            print("-----------------------------------------------------------")
            print("BEFORE \(self.fetchedRecordsController.fetchedRecords!.map { ["id":$0.id, "position":$0.position] })")
            self.tableView.beginUpdates()
        }
        
        fetchedRecordsController.onEvent { [unowned self] (person, event) in
            // Apply individual event
            print(event)
            switch event {
            case .Insertion(let indexPath):
                self.tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
