 
   func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
     if let cell = tableView.cellForRow(at: indexPath) {
-      var cellInfo = dataSource.cells[safe: indexPath.row] as! FriendCellInfo
-      cellInfo.selected = true
+      let cellInfo = dataSource.cells[safe: indexPath.row] as! FriendCellInfo
+      dataSource.selectedFriends.append(cellInfo.fbid)
       cell.accessoryType = .checkmark
     }
   }
 
   func tableView(_ tableView: UITableView,
                  didDeselectRowAt indexPath: IndexPath) {
-    var cellInfo = dataSource.cells[safe: indexPath.row] as! FriendCellInfo
     if let cell = tableView.cellForRow(at: indexPath) {
-      cellInfo.selected = false
+      let cellInfo = dataSource.cells[safe: indexPath.row] as! FriendCellInfo
+      dataSource.selectedFriends = dataSource.selectedFriends.filter { (fbid) -> Bool in
+        return fbid != cellInfo.fbid
+      }
       cell.accessoryType = .none
     }
   }


struct FriendCellInfo : CellInfo {
  let cellIdentifier: String = FriendCell.identifier
  let name: String
  let picture: String
  var selected: Bool
}

class FriendCell: ConfigurableTableViewCell {

    }

    cell.configure(cellInfo: cellInfo)
    cell.accessoryType = dataSource.selectedFriends.contains(cellInfo.fbid) ? .checkmark : .none
    return cell
  }

