                     guard let messageRef = weakSelf.ref else {return}
                     weakSelf.updateReadMsgCount(forRefrence: messageRef.childByAppendingPath(id))
                 }
-                
-            }
-            
+            }
             }, withCancelBlock: { error in
                 print(error.description)
         })

                        (currentData:FMutableData!) in
                        guard let userName = self.userName else {return FTransactionResult.successWithValue(currentData)}
                        let unreadCountData = currentData.childDataByAppendingPath("\(userName)_unreadCount")
                        //                        let totalCountData = currentData.childDataByAppendingPath("\(self.userName ?? "")_totalCount")
                        //
                        //                        var totalCount = totalCountData.value as? Int
                        //                        if totalCount == nil {
                        //                            totalCount = 0
                        //                        }
                        //                        totalCountData.value = totalCount! - 1
                        
                        var unreadCount = unreadCountData.value as? Int
                        if unreadCount == nil {
                            unreadCount = 0

        self.tableView.addGestureRecognizer(tap)
        ref = Firebase(url:Constants.FIREBASE_BASE_URL.stringByAppendingString("/chats/\(chat?.channelName ?? "")/messages"))
        channelRef = Firebase(url:Constants.FIREBASE_BASE_URL.stringByAppendingString("/chats/\(chat?.channelName ?? "")"))
    }
    
    override func didReceiveMemoryWarning() {
