     }
 
     @IBAction func removeAll(sender: UIBarButtonItem) {
-        segmentedDatasourceProvider.selectedDatasourceProvider.removeAllEvents()
+        selectedDatasourceProvider.removeAllEvents()
+    }
+
+    // UITableViewDelegate - Editing
+
+    func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
+        return selectedDatasourceProvider.editActionForItemAtIndexPath?(indexPath: indexPath).editingStyle ?? .None
     }
 }
 

        let colors: [Event.Color] = [.Red, .Blue, .Green]
        let datasources = colors.map { EventsDatasource(color: $0, db: database, view: self.tableView) }

        segmentedDatasourceProvider = SegmentedDatasourceProvider(id: "events segmented datasource", datasources: datasources, selectedIndex: 0) { [weak self] in
            self?.tableView.reloadData()
        }

        segmentedDatasourceProvider.configureSegmentedControl(segmentedControl)

        datasource = BasicTableViewDataSourceProvider(segmentedDatasourceProvider)
        tableView.dataSource = datasource.tableViewDataSource
    }

    @IBAction func addEvent(sender: UIBarButtonItem) {
        let color = segmentedDatasourceProvider.selectedDatasourceProvider.eventColor
        segmentedDatasourceProvider.selectedDatasourceProvider.addEvent(Event.create(color: color))
    }

    @IBAction func refreshEvents(sender: UIBarButtonItem) {

    let eventColor: Event.Color
    let datasource: Datasource

    var canEditItemAtIndexPath: CanEditItemAtIndexPath? {
        return { _ in true }
    }

    var commitEditActionForItemAtIndexPath: CommitEditActionForItemAtIndexPath? {
        return { (action, indexPath) in
            switch action {
            case .Delete:
                if let item = self.datasource.itemAtIndexPath(indexPath) {
                    self.readWriteConnection.remove(item)
                }
            default: break
            }
        }
    }

    var editActionForItemAtIndexPath: EditActionForItemAtIndexPath? {
        return { _ in .Delete }
    }

    var canMoveItemAtIndexPath: CanMoveItemAtIndexPath? {
        return { _ in false }
    }

    var commitMoveItemAtIndexPathToIndexPath: CommitMoveItemAtIndexPathToIndexPath? {
        return { (_, _) in }
    }

    init(color: Event.Color, db: YapDatabase, view: Factory.ViewType) {

        var ds = YapDBDatasource(id: "\(color) events datasource", database: db, factory: Factory(), processChanges: view.processChanges, configuration: eventsWithColor(color, byColor: true) { mappings in
