             if self.tableview != nil {
                 var inProgressIndex = 0
                 var completeIndex = 0
+                var tempModel: AppointmentModel? = nil
                 
                 let dic = snapshot.value as? NSDictionary
                 var arr = [AppointmentModel]()

                }

                DispatchQueue.main.async {
                    var arrNew = arr.filter({ (model) -> Bool in
                        model.currentStatus.lowercased() == "new"
                    })
                    if self.listBlock != nil {
                        if arrNew.count > 0 {
                            self.listBlock!(arrNew[0] as AnyObject)
                        } else {
                            self.listBlock!(AppointmentModel() as AnyObject)
                        }

                    
                    if model.currentStatus.lowercased() == "new" {
                        arr.insert(model, at: 0)
                        tempModel = model
                        inProgressIndex += 1
                        completeIndex += 1
                    } else if model.currentStatus.lowercased() == "in progress" {
