     }
 
     cell.configure(cellInfo: cellInfo)
-    cell.accessoryType =
-        (cellInfo as! FriendCellInfo).selected ? .checkmark : .none
+    cell.accessoryType = dataSource.selectedFriends.contains(cellInfo.fbid) ? .checkmark : .none
     return cell
   }
 

  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath)
      -> UITableViewCell {
    guard
      let cellInfo = dataSource.cells[safe: indexPath.row],
      let cell =
          tableView.dequeueReusableCell(withIdentifier: cellInfo.cellIdentifier,
                                        for: indexPath)


  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    if let cell = tableView.cellForRow(at: indexPath) {
      let cellInfo = dataSource.cells[safe: indexPath.row] as! FriendCellInfo
      dataSource.selectedFriends.append(cellInfo.fbid)
      cell.accessoryType = .checkmark
    }
  }

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