public NewEventsPoller(string connectionString, Guid token, IUsersClient usersClient, IChatsClient chatsClient) : base(connectionString, token, true, 3000) { AreChatsPolled = false; UsersStorage = new Dictionary <int, User>(); ChatsStorage = new Dictionary <int, Chat>(); ChatUserInfosCache = new CacheStorage <ChatUserId, ChatUserInfo>(); _lastUserId = -1; _newChatInfoHandlers = new Dictionary <int, EventHandler <Chat> >(); _newChatMembersHandlers = new Dictionary <int, EventHandler <IEnumerable <int> > >(); _newChatMessagesHandlers = new Dictionary <int, EventHandler <IEnumerable <Message> > >(); _newChatUserInfosHandlers = new Dictionary <ChatUserId, EventHandler <ChatUserInfo> >(); _newUserInfoHandlers = new Dictionary <int, EventHandler <User> >(); usersClient.GetAllUsersAsync().Result.ForEach(x => UsersStorage.Add(x.Id, x)); chatsClient.GetUserChatsAsync().Result.ForEach(x => { if (!ChatsStorage.ContainsKey(x.Id)) { ChatsStorage.Add(x.Id, x); } }); _usersClient = usersClient; }