             let insideChatVC = segue.destinationViewController as? InsideChatViewController,
             let selectedPath = tableView.indexPathForSelectedRow {
 
-            let chat = model[selectedPath.row]
+            let chat = activeModel[selectedPath.row]
             insideChatVC.chatID = chat.chatID
             insideChatVC.chatName = chat.name
             tableView.deselectRowAtIndexPath(selectedPath, animated: true)

    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return model.count
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! ChatCell

        cell.inject(chat: model[indexPath.row])

        return cell
    }


    @IBOutlet private var tableView: UITableView!

    private var searchModel: [Chat]?
    private var fullModel = [Chat]()
    private var activeModel: [Chat] {
        get {
            return searchModel ?? fullModel
        }
    }
    private var cellIdentifier = "ChatCell"
    private var plusButtonHeight: CGFloat = 72

    override func viewDidLoad() {
        ChatClient.getList(success: { chats in
            self.fullModel = chats
            self.tableView.reloadData()
        })

