         didSet{
             if let operations = selectedOperations {
                  let indexes:[Int]=operations.map({ (operation) -> Int in
-                    return self.operations.indexOf(operation)!
+                    return self.operations.indexOf( { return $0.UID == operation.UID })!
                 })
                 self.registryMetadata.stateDictionary[BartlebyDocument.kSelectedOperationsIndexesKey]=indexes
                 NSNotificationCenter.defaultCenter().postNotificationName(BartlebyDocument.OPERATIONS_SELECTED_INDEXES_CHANGED_NOTIFICATION, object: nil)

        didSet{
            if let permissions = selectedPermissions {
                 let indexes:[Int]=permissions.map({ (permission) -> Int in
                    return self.permissions.indexOf(permission)!
                })
                self.registryMetadata.stateDictionary[BartlebyDocument.kSelectedPermissionsIndexesKey]=indexes
                NSNotificationCenter.defaultCenter().postNotificationName(BartlebyDocument.PERMISSIONS_SELECTED_INDEXES_CHANGED_NOTIFICATION, object: nil)

        didSet{
            if let groups = selectedGroups {
                 let indexes:[Int]=groups.map({ (group) -> Int in
                    return self.groups.indexOf( { return $0.UID == group.UID })!
                })
                self.registryMetadata.stateDictionary[BartlebyDocument.kSelectedGroupsIndexesKey]=indexes
                NSNotificationCenter.defaultCenter().postNotificationName(BartlebyDocument.GROUPS_SELECTED_INDEXES_CHANGED_NOTIFICATION, object: nil)
