private bool FillFacebookInfo(ClientInfo ManagedUserInfo)
        {
            if (ManagedUserInfo != null)
                if (!string.IsNullOrEmpty(ManagedUserInfo.FacebookId))
                {
                    using (Database db = new MySqlDatabase())
                    {
                        ClientInfo ci = db.GetClientInfo(Convert.ToInt64(Session["managed.userid"]));

                        Session["FBACC"] = db.GetSocialCredential(ci.ClientId, SocialConnector.Facebook, "accesstoken");

                        string expiresRaw = db.GetSocialCredential(ci.ClientId, SocialConnector.Facebook, "accesstokenexpires");

                        Facebook.AuthenticationService authServices = new Facebook.AuthenticationService();

                        if (authServices.TryAuthenticateAdminFBCred(expiresRaw, Convert.ToString(Session["FBACC"])))
                        {
                            Me me = authServices.GetMe(Convert.ToString(Session["FBACC"]));

                            try
                            {
                                Session["FBID"] = me.Id;
                            }
                            catch { }

                            FillFBFriendList(Convert.ToString(Session["FBACC"]));

                            FillFBPageList(Convert.ToString(Session["FBACC"]));

                            cbxShareToUserWall.Enabled = true;

                            cbxShareToUserWall.Visible = true;

                            divShareToUserWall.Visible = true;

                            return true;
                        }
                        else
                        {
                            Session["FBACC"] = Session["FBID"] = null;

                            db.RemoveSocialCredential(ci.ClientId, SocialConnector.Facebook);

                            db.UpdateFacebookID(ci.ClientId);

                            FillFBFriendList(null);

                            FillFBPageList(null);

                            cbxShareToUserWall.Enabled = false;

                            cbxShareToUserWall.Visible = false;

                            divShareToUserWall.Visible = false;

                            return false;
                        }
                    }
                }

            Session["FBACC"] = Session["FBID"] = null;

            FillFBFriendList(null);

            FillFBPageList(null);

            cbxShareToUserWall.Enabled = false;

            cbxShareToUserWall.Visible = false;

            divShareToUserWall.Visible = false;

            return false;
        }
        private void FillManagedArtistDropDown()
        {
            ddlManagedArtist.Items.Clear();
            ddlManagedArtist.Items.Add(new ListItem("---", "0"));

            using (Database db = new MySqlDatabase())
            {
                UserInfo[] uis = db.GetManagedUsers(Util.UserId, 1);

                foreach (UserInfo ui in uis)
                {
                    ClientInfo ci = db.GetClientInfo(ui.UserId);
                    ddlManagedArtist.Items.Add(new ListItem(ci.GetFullName(), ui.UserId.ToString()));
                }

                if (!string.IsNullOrEmpty(Request["id"]))
                {
                    Session["managed.userid"] = Convert.ToInt64(Request["id"]);

                    IsrcHandle.Text = GetIsrcCode(Convert.ToInt64(Session["managed.userid"]));

                    ddlManagedArtist.SelectedValue = Request.QueryString["id"].ToString();

                    ClientInfo _ManagedUserInfo = db.GetClientInfo(Convert.ToInt64(Request.QueryString["id"]));

                    string accessToken = db.GetSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook, "accesstoken");

                    string expiresRaw = db.GetSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook, "accesstokenexpires");

                    bool isNotExpired = true;

                    Facebook.AuthenticationService authService = new Facebook.AuthenticationService();

                    if (authService.TryAuthenticateAdminFBCred(expiresRaw, accessToken))
                    {
                        isNotExpired = true;
                    }
                    else
                    {
                        db.RemoveSocialCredential(_ManagedUserInfo.ClientId, SocialConnector.Facebook);
                        db.UpdateFacebookID(_ManagedUserInfo.ClientId);

                        isNotExpired = false;
                    }

                }
            }
        }