     // Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES.
     */
     func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
-        return self.itemAtIndexPath(indexPath).editingStyle
+        if let item = self.itemAtIndexPath(indexPath) {
+            return item.editingStyle
+        }
+        return .None
     }
     
     

    */

    func tableView(tableView: UITableView, targetIndexPathForMoveFromRowAtIndexPath sourceIndexPath: NSIndexPath, toProposedIndexPath proposedDestinationIndexPath: NSIndexPath) -> NSIndexPath {
        let sourceSection = self.sectionAtIndexPath(sourceIndexPath)
        let item = self.itemAtIndexPath(sourceIndexPath)
        if let moveHandler = item.moveHandler {
            let allowed = moveHandler(section: sourceSection, item: item, tableView: tableView, sourceIndexPath: sourceIndexPath, destinationIndexPath: proposedDestinationIndexPath)
            if !allowed {
                return sourceIndexPath
            }
        }
        
        return proposedDestinationIndexPath
    }

    func tableView(tableView: UITableView, indentationLevelForRowAtIndexPath indexPath: NSIndexPath) -> Int {
        return self.itemAtIndexPath(indexPath).indentationLevel
    }
    
    func tableView(tableView: UITableView, shouldShowMenuForRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        let item = self.itemAtIndexPath(indexPath)
        return item.copyHandler != nil || item.pasteHandler != nil || item.cutHandler != nil
        
    }
    
    func tableView(tableView: UITableView, canPerformAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject) -> Bool {
        let item = self.itemAtIndexPath(indexPath)
        
        if item.copyHandler != nil && action == Selector("copy:") {
            return true
        }
        
        if item.pasteHandler != nil && action == Selector("paste:") {
            return true
        }
        
        if item.cutHandler != nil && action == Selector("cut:") {
            return true
        }
        
        return false
    }
    
    func tableView(tableView: UITableView, performAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject!) {
        let item = self.itemAtIndexPath(indexPath)
        let section = self.sectionAtIndexPath(indexPath)
        if let copyHandler = item.copyHandler where action == Selector("copy:") {
            copyHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
        }
        if let pasteHandler = item.pasteHandler where action == Selector("paste:") {
            pasteHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
        }
        if let cutHandler = item.cutHandler where action == Selector("cut:") {
            cutHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
        }
    }
}
    
    // MARK: Private methods
    //
    private func sectionAtIndexPath(indexPath: NSIndexPath) -> TableViewSection? {
        if let dataSource = self.dataSource {
            if indexPath.section < dataSource.sections.count {
                return dataSource.sections[indexPath.section] as TableViewSection!
            }
        }
        return nil
    }
    
    private func itemAtIndexPath(indexPath: NSIndexPath) -> TableViewItem? {
        if let section = self.sectionAtIndexPath(indexPath) {
            if (indexPath.row < section.items.count) {
                return section.items[indexPath.row] as TableViewItem!
            }
        }
        return nil
    }
    
    // MARK: <UITableViewDataSource> methods
