     
   let list = NSView(frame: NSMakeRect(0,0,220,1560+900))
   var disposeBag = DisposeBag()
-  
+  var team: Team?
   
   func sortByLastMsgDate(notification: NSNotification) {
     

    
  func companyDidChange(notification: NSNotification) {
    let team = notification.object as! Team

    
    let provider = RxMoyaProvider<ChatService>()
    let channelApi = ChannelApiImpl(provider: provider)

      let id = cwr.button.stringTag
      
      //let ob = channelApi.getHistoryByFlavor(token: token!, id:id, flavor: flavor, count: 1)
      
      let url = "https://slack.com/api/\(flavor).history?token=\(token ?? "")&channel=\(id)&count=1"
      
      //Swift.print("Request: \(url)")
      group.enter()
      
      Alamofire.request(url).responseJSON { response in
        if let json = response.result.value as? [String: Any] {
          
          let messages = json["messages"]
          if messages != nil {
            let list = json["messages"] as! NSArray
            if list.count > 0 {
              let message = list[0] as? [String: Any]
              let ts = message?["ts"] as! String
              let tsd = Double(ts)
              var d = NSMutableDictionary()
              d["ts"] = tsd
              d["id"] = id
              d["flavor"] = flavor
              d["name"] = cwr.button.title
                sortList.append(d)
              //Swift.print("JSON: \(tsd)")
            }
          }
        }
        //
        group.leave()
      }
    }
    
    
    
    group.notify(queue: DispatchQueue.main, execute: {
      
