 class Document: NSDocument {
    
     @objc(employees)
-     var employees: NSMutableArray = NSMutableArray() {
+    var employees:[Person] = [Person]() {
         willSet {
             for person in employees {
                 self.stopObservingPerson(person as Person)

    }
    
    
    func insertObject(p: Person, atEmployeesObjectIndex index: Int){
        println("adding \(p) to \(self.employees)")
        let undo = self.undoManager
        undo?.prepareWithInvocationTarget(self).removeObjectAtArrangedObjectIndex(index)
        
        if (false == undo?.undoing) {
            undo?.setActionName("Add Person")
        }
        
        self.employees.insertObject(p, atIndex: index) 
    }
    
    func removeObjectAtEmployeesIndex(index: Int) {
        let p: Person = self.employees.objectAtIndex(index) as Person
        println("removing \(p) to \(self.employees)")
        let undo = self.undoManager
        
        undo?.prepareWithInvocationTarget(self).insertObject(p, atArrangedObjectIndex: index)
        
        
        if (false == undo?.undoing) {
            undo?.setActionName("Remove Person")
        }
        
        self.employees.removeObjectAtIndex(index)
       
    }
    
}


                self.startObservingPerson(person as Person)
            }
        }
    }
    
    @IBOutlet var tableView: NSTableView!
