protected void btnDestroy_Click(object sender, EventArgs e)
        {
            if (ListUsers.Count > 0)
            {
                bool usersChanged     = false;
                bool followersChanged = false;

                TwitterAuthenticate();
                try {
                    foreach (GridViewRow row in gvUsers.Rows)
                    {
                        Control ctrl = row.FindControl("cbxDelete");
                        if (ctrl != null)
                        {
                            CheckBox cbx = (CheckBox)ctrl;
                            if (cbx.Checked)
                            {
                                Control lblctrl = row.FindControl("lblUserId");
                                if (lblctrl != null)
                                {
                                    Label lbl  = (Label)lblctrl;
                                    var   user = ListUsers.Where(k => k.UserId == lbl.Text).FirstOrDefault();
                                    if (user != null)
                                    {
                                        twdata = new Twitter(user, Twitter.TwitterType.Unfollow);
                                        Twitter.User utoremove = ListFriends.Find(x => x.UserId == user.UserId);
                                        if (utoremove != null && ListFriends.Contains(utoremove))
                                        {
                                            ListFriends.Remove(utoremove);
                                            followersChanged = true;
                                        }
                                        ListUsers.Remove(user);
                                        usersChanged = true;
                                    }
                                }
                            }
                        }
                    }
                    if (followersChanged)
                    {
                        Serializer.WriteFollowersXML(ListFriends.ToList(), Constants.FriendsFollowers.Friends.ToString());
                    }
                    if (usersChanged)
                    {
                        Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Analyze.ToString());
                        Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Unfollow.ToString());
                        Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Users.ToString());
                    }
                    BindData();
                } catch (WebException wex) {
                    BindData();
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", string.Format("alert('{0}');", "No internet connection: " + wex.Message.Replace("'", string.Empty)), true);
                } catch (Exception ex) {
                    //do nothing
                }
            }
        }
        protected void btnDestroyAll_Click(object sender, EventArgs e)
        {
            if (ListUsers.Count > 0)
            {
                bool followersChanged = false;

                TwitterAuthenticate();
                try {
                    foreach (Twitter.User user in ListUsers)
                    {
                        twdata = new Twitter(user, Twitter.TwitterType.Unfollow);
                        Twitter.User utoremove = ListFriends.Find(x => x.UserId == user.UserId);
                        if (utoremove != null && ListFriends.Contains(utoremove))
                        {
                            ListFriends.Remove(utoremove);
                            followersChanged = true;
                        }
                    }
                    ListUsers.Clear();
                    if (followersChanged)
                    {
                        Serializer.WriteFollowersXML(ListFriends.ToList(), Constants.FriendsFollowers.Friends.ToString());
                    }

                    Serializer.DeleteListXML(Constants.FriendsFollowers.Analyze.ToString());
                    Serializer.DeleteListXML(Constants.FriendsFollowers.Unfollow.ToString());
                    Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Users.ToString());
                    BindData();
                } catch (WebException wex) {
                    BindData();
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", string.Format("alert('{0}');", "No internet connection: " + wex.Message.Replace("'", string.Empty)), true);
                } catch (Exception ex) {
                    //do nothing
                }
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (ListUsers.Count > 0)
            {
                bool usersChanged     = false;
                bool friendsChanged   = false;
                bool followersChanged = false;

                foreach (GridViewRow row in gvUsers.Rows)
                {
                    Control ctrl = row.FindControl("cbxDelete");
                    if (ctrl != null)
                    {
                        CheckBox cbx = (CheckBox)ctrl;
                        if (cbx.Checked)
                        {
                            Control lblctrl = row.FindControl("lblUserId");
                            if (lblctrl != null)
                            {
                                Label lbl  = (Label)lblctrl;
                                var   user = ListUsers.Where(k => k.UserId == lbl.Text).FirstOrDefault();
                                if (user != null)
                                {
                                    var uremove = ListFriends.Where(x => x.UserId == user.UserId).FirstOrDefault();
                                    if (uremove != null)
                                    {
                                        ListFriends.Remove(uremove);
                                        friendsChanged = true;
                                    }
                                    var furemove = ListFollowers.Where(x => x.UserId == user.UserId).FirstOrDefault();
                                    if (furemove != null)
                                    {
                                        ListFollowers.Remove(furemove);
                                        followersChanged = true;
                                    }
                                    ListUsers.Remove(user);
                                    usersChanged = true;
                                }
                            }
                        }
                    }
                }
                if (friendsChanged)
                {
                    Serializer.WriteFollowersXML(ListFriends.ToList(), Constants.FriendsFollowers.Friends.ToString());
                }
                if (followersChanged)
                {
                    Serializer.WriteFollowersXML(ListFollowers.ToList(), Constants.FriendsFollowers.Followers.ToString());
                }
                if (usersChanged)
                {
                    if (friendsChanged)
                    {
                        Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Analyze.ToString());
                    }
                    if (friendsChanged)
                    {
                        Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Unfollow.ToString());
                    }
                    if (followersChanged)
                    {
                        Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.NotFollowing.ToString());
                    }
                    Serializer.WriteFollowersXML(ListUsers.ToList(), Constants.FriendsFollowers.Users.ToString());
                }
                BindData();
            }
        }