                         (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
+                        //                        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 {

            let from = snapshot.value[ChatMessage.FireBasePropertyKey.from] as? String ?? ""
            let to = snapshot.value[ChatMessage.FireBasePropertyKey.to] as? String ?? ""
            let message = snapshot.value[ChatMessage.FireBasePropertyKey.message] as? String ?? ""
            let timeStamp = snapshot.value[ChatMessage.FireBasePropertyKey.timeStamp] as? NSDate ?? NSDate()
            let read = snapshot.value[ChatMessage.FireBasePropertyKey.read] as? Bool ?? true
            let chatMessage = ChatMessage(id: id, from: from, to: to, message: message, timeStamp: timeStamp, read: read)
            weakSelf.chatMessages.append(chatMessage)
            weakSelf.tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: weakSelf.chatMessages.count-1, inSection: 0)], withRowAnimation: .Automatic)
            weakSelf.tableView.scrollToRowAtIndexPath(NSIndexPath(forRow: weakSelf.chatMessages.count-1, inSection: 0), atScrollPosition: .Bottom, animated: true)
            if (from != weakSelf.userName) && !read{
                guard let messageRef = weakSelf.ref else {return}
                weakSelf.updateReadMsgCount(forRefrence: messageRef.childByAppendingPath(id))
            }
            
            
            }, withCancelBlock: { error in
                print(error.description)

        super.viewWillAppear(animated)
        registerMsgAddedObserver()
        registerMsgRemovedObserver()
        registerMsgChangedObserver()
    }
    
    func registerMsgAddedObserver() {
