private void Toggle(ServerListItem item)
 {
     if (this._expandedFlag.IndexOf(item.Name) == -1)
     {
         this.Expand(item);
         return;
     }
     this.Collapse(item);
 }
        protected void Expand(ServerListItem item)
        {
            if (this._expandedFlag.IndexOf(item.Name) > -1)
            {
                return;
            }
            int index = this.Items.IndexOf(item) + 1;

            this._expandedFlag.Add(item.Name);
            item.Expanded = true;
            foreach (ServerListItem current in item.Servers)
            {
                this.Items.Insert(index, current);
            }
        }
        protected void Collapse(ServerListItem item)
        {
            if (this._expandedFlag.IndexOf(item.Name) == -1)
            {
                return;
            }
            int index = this.Items.IndexOf(item) + 1;

            for (int i = 0; i < item.Servers.Count; i++)
            {
                try
                {
                    this.Items.RemoveAt(index);
                }
                catch (ArgumentOutOfRangeException)
                {
                }
            }
            this._expandedFlag.Remove(item.Name);
            item.Expanded = false;
        }