/// <summary>
        /// Subscribed given chat to the given project.
        /// </summary>
        /// <param name="chatName">
        /// The chat name.
        /// </param>
        /// <param name="projectId">
        /// The project id.
        /// </param>
        public void SubscribeChat(string chatName, int projectId)
        {
            ChatSubscription chatSubscription =
                this.chatSubscriptionRepository.GetAll()
                .FirstOrDefault(c => string.Compare(c.ChatName, chatName, StringComparison.OrdinalIgnoreCase) == 0);

            if (chatSubscription == null)
            {
                // chat wasn't subscribed to any project yet.
                this.chatSubscriptionRepository.Create(
                    new ChatSubscription {
                    ChatName = chatName, ProjectId = projectId
                });
            }
            else
            {
                // chat was subscribed to smth already.
                this.chatSubscriptionRepository.Update(
                    new ChatSubscription {
                    Id = chatSubscription.Id, ChatName = chatName, ProjectId = projectId
                });
            }

            if (!this.chatProjectMapping.ContainsKey(chatName))
            {
                this.chatProjectMapping.Add(chatName, projectId);
            }
            else
            {
                this.chatProjectMapping[chatName] = projectId;
            }
        }
        /// <summary>
        /// Unsubscribes chat from any project.
        /// </summary>
        /// <param name="chatName">
        /// The chat name.
        /// </param>
        public void UnsubscribeChat(string chatName)
        {
            ChatSubscription chatSubscription =
                this.chatSubscriptionRepository.GetAll()
                .FirstOrDefault(c => string.Compare(c.ChatName, chatName, StringComparison.OrdinalIgnoreCase) == 0);

            this.chatSubscriptionRepository.Delete(chatSubscription);

            if (this.chatProjectMapping.ContainsKey(chatName))
            {
                this.chatProjectMapping.Remove(chatName);
            }
        }