private void CloseServerProviders()
        {
            UIConversation[] temp = new UIConversation[ConversationProvider.Conversations.Count];
            ConversationProvider.Conversations.CopyTo(temp, 0);

            foreach (var item in temp)
            {
                if (item is UIServerConversation)
                {
                    RemoveServerConversation(((UIServerConversation)item));
                }
            }
        }
 private void RemoveServerConversation(UIServerConversation conversation)
 {
     if (conversation.Session.State != IrcSessionState.Closed && conversation.Session.State != IrcSessionState.Closing)
     {
         UIConversation[] temp = new UIConversation[ConversationProvider.Conversations.Count];
         ConversationProvider.Conversations.CopyTo(temp, 0);
         foreach (UIConversation c in temp)
         {
             if (c is UIChannelConversation && conversation.ContainsChannelConversation(((UIChannelConversation)c).Channel))
             {
                 RemoveChannelConversation((UIChannelConversation)c);
             }
             else if (c is UIPersonConversation && conversation.ContainsPersonConversation(((UIPersonConversation)c).Person))
             {
                 RemovePersonConversation((UIPersonConversation)c);
             }
         }
         conversation.Session.Close();
     }
     _syncContext.Send(() => ConversationProvider.Conversations.Remove(conversation));
 }