public string CreateBoard_new(string BoardName, string Category, ref PinInterestUser objPinUser)
        {
            try
            {
                string Checking = objPinUser.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com/settings/"));
                string ScreenName = objPinUser.ScreenName; //ObjAccountManager.Getscreen_NameRepin(ref objPinUser);
                if (Checking.Contains("profileName"))
                {
                }
                else
                {
                    ObjAccountManager.LoginPinterestAccount(ref objPinUser);
                }
                string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0];
                string newHomePageUrl = redirectDomain + "." + "pinterest.com";

                if (!string.IsNullOrEmpty(Checking))
                {
                    ChilkatHttpHelpr objChilkatHttpHelpr = new ChilkatHttpHelpr();

                    //string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App()%3EUserProfilePage(resource%3DUserResource(username%3D" + ScreenName + "%2C+invite_code%3Dnull))%3EUserProfileContent(resource%3DUserResource(username%3D" + objPinUser.ScreenName + "%2C+invite_code%3Dnull))%3EUserBoards()%3EGrid(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EGridItems(resource%3DProfileBoardsResource(username%3D" + ScreenName + "))%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23Modal(module%3DBoardCreate())";
                    string newpostdata = "source_url=%2F" + ScreenName + "%2F&data=%7B%22options%22%3A%7B%22name%22%3A%22" + (BoardName.Replace(" ", "+")) + "%22%2C%22category%22%3A%22other%22%2C%22description%22%3A%22%22%2C%22privacy%22%3A%22public%22%2C%22layout%22%3A%22default%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EUserProfilePage%3EUserProfileContent%3EUserBoards%3EGrid%3EGridItems%3EBoardCreateRep(ga_category%3Dboard_create%2C+text%3DCreate+a+board%2C+submodule%3D%5Bobject+Object%5D)%23App%3EModalManager%3EModal(showCloseModal%3Dtrue%2C+mouseDownInModal%3Dfalse)";
                    string PostUrlBoard = redirectDomain + ".pinterest.com/resource/BoardResource/create/";
                    try
                    {
                        CreatedBoardPageSource = objPinUser.globusHttpHelper.postFormDataProxyPin(new Uri(PostUrlBoard), newpostdata, newHomePageUrl);
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                    }

                    if (CreatedBoardPageSource.Contains("error\": null"))
                    {
                        if (newpostdata.Contains("You already have a board with that name."))
                        {
                            GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]");
                            return null;
                        }
                        try
                        {
                            string ModuleName = "AddBoardName";
                            string Status = "Board_Created";
                            QueryManager qm = new QueryManager();
                            qm.insertAccRePort(objPinUser.Username, ModuleName, "", BoardName, "", "", "", "", Status, "", "", DateTime.Now);
                            //qm.insertBoard_AddBoardName(objPinUser.Username, ModuleName, BoardName, Status);
                            objDelegateAccountReport();
                        }
                        catch (Exception ex)
                        {
                            GlobusLogHelper.log.Info(" => [ Board Created " + BoardName + " ]");
                            return null;
                        }
                        
                        GlobusLogHelper.log.Info(" => [ Successfully Created Board " + BoardName + " For " + objPinUser.Username + " ]");
                        string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser);//GetBoardId(BoardName, ref pinterestAccountManager);
                        return BoardId;

                    }
                    else if (CreatedBoardPageSource.Contains("You have a board with this name."))
                    {
                        GlobusLogHelper.log.Info(" => [ You already have a board with this name. " + BoardName + " For " + objPinUser.Username + " ]");
                        string BoardId = objAddNewPinManager.GetBoardId_Board(BoardName, ref objPinUser);
                        return BoardId;
                    }
                    else
                    {
                        GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]");
                        return CreatedBoardPageSource;
                    }
                }
                else
                {
                    GlobusLogHelper.log.Info(" => [ Login Issue " + " For " + objPinUser.Username + " ]");
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info(" => [ Board Creation Process Failed " + BoardName + " ]");
                return null;
            }
            return null;
        }
        public bool AddUserToBoard(string BoardName, string UserName, string Category, ref PinInterestUser pinterestAccountManager)
        {
            try
            {
                GlobusLogHelper.log.Info(" => [ Start Adding " + UserName + " to " + BoardName + " ]");
                string checklogin = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri("https://www.pinterest.com"));
                string redirectDomain = GlobusHttpHelper.valueURl.Split('.')[0];
                string newHomePageUrl = redirectDomain + "." + "pinterest.com";

                string screen_Name = pinterestAccountManager.ScreenName; //ObjAccountManager.Getscreen_Name(ref pinterestAccountManager);

                pinterestAccountManager.globusHttpHelper = new GlobusHttpHelper();
                BoardName = BoardName.Replace(" ", "-");
                string AfterInvitePageSourceData = string.Empty;
                string userid = string.Empty;

                if (BoardName.Contains("pinterest.com"))
                {
                    BoardName = BoardName.Replace("https://pinterest.com/", string.Empty).Replace(pinterestAccountManager.Name, string.Empty).Trim('/');
                }

                string BoardUrl = "https://pinterest.com/" + pinterestAccountManager.ScreenName + "/" + BoardName + "/";
                string SettingsUrl = BoardUrl + "settings/";
                string Collabrator = BoardUrl;
                string InvitePostData1 = "collaborator_name=&collaborator_username="******"-", "+");


                string invited_userid = string.Empty;
                string invited = "https://pinterest.com/" + UserName.Replace(" ", "").Replace("%20", "");
                string pagesourceinvited = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(invited));
                
                try
                {
                    invited_userid = Utils.Utils.getBetween(pagesourceinvited, "options\": {\"user_id\"", "}");
                    invited_userid = Utils.Utils.getBetween(invited_userid, "\"", "\"");
                }
                catch { };

               

                string MainPageSource = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(BoardUrl), "https://pinterest.com/", string.Empty, pinterestAccountManager.UserAgent);

                try
                {
                    int startindex = MainPageSource.IndexOf("\"user_id\":");
                    string start = MainPageSource.Substring(startindex).Replace("\"user_id\":", "");
                    int endindex = start.IndexOf(",");
                    string end = start.Substring(0, endindex);
                    userid = end.Replace("\"", "").Replace("}}", string.Empty).Trim();
                }
                catch (Exception ex)
                {
                    GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
                }

                //string screen_Name = ObjAccountManager.Getscreen_Name(ref pinterestAccountManager);
                string BoardId = Utils.Utils.getBetween(MainPageSource, "board\", \"id", ",").Replace("\"", "").Replace(":", "").Trim();
              
                string InviteToBoardPostData = string.Empty;
             

               // if (ObjAccountManager.LoginPinterestAccount(ref pinterestAccountManager))
                if (ObjAccountManager.LoginPinterestAccount(ref pinterestAccountManager))
                {                 
                    string Url = "https://www.pinterest.com/resource/BoardInviteResource/get/?source_url=%2F" + screen_Name + "%2Fhealth%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%2C%22field_set_key%22%3A%22boardEdit%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=Modal()%3EBoardCollaboratorInviter(resource%3DBoardResource(board_id%3D" + BoardId + "))%3EBoardInviteForm()%3ESocialTypeaheadField()%3ETypeahead(bypass_maxheight%3Dtrue%2C+tags%3Dpinners_and_contacts%2C+template%3Duser_circle_avatar%2C+view_type%3DuserCircleSelect)&_=1431320928412";

                    string getResponce = pinterestAccountManager.globusHttpHelper.getHtmlfromUrl(new Uri(Url));

                    if (UserName.Contains("@"))
                    {
                        UserName = UserName.Replace("@", "%40");
                        //InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal()";
                        InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2Fas%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22emails%22%3A%5B%22" + UserName + "%22%5D%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EModalManager%3EModal%3EBoardCollaboratorInviter%3EBoardInviteForm%3EButton(class_name%3DinviteButton%2C+text%3DInvite%2C+color%3Ddefault%2C+state_badgeValue%3D%22%22%2C+state_accessibilityText%3D%22%22%2C+state_disabled%3Dundefined)";
                        try
                        {
                            string postInviteEmail = redirectDomain + ".pinterest.com/resource/BoardEmailInviteResource/create/";
                            AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postInviteEmail), InviteToBoardPostData, newHomePageUrl);
                        }
                        catch (Exception ex)
                        { };                  
                    }
                    else
                    {
                        InviteToBoardPostData = "source_url=%2F" + screen_Name + "%2F" + BoardName + "%2F&data=%7B%22options%22%3A%7B%22board_id%22%3A%22" + BoardId + "%22%2C%22invited_user_id%22%3A%22" + invited_userid + "%22%7D%2C%22context%22%3A%7B%7D%7D&module_path=App%3EBoardPage%3EBoardHeader%3EBoardInfoBar%3EShowModalButton(module%3DBoardCollaboratorInviter)%23App%3EModalManager%3EModal(state_isVisible%3Dtrue%2C+showCloseModal%3Dtrue%2C+state_mouseDownInModal%3Dtrue%2C+state_showModalMask%3Dtrue%2C+state_showContainer%3Dfalse%2C+state_showPositionElement%3Dtrue)";
                        try
                        {
                            string postUrlInviteBoard = redirectDomain + ".pinterest.com/resource/BoardInviteResource/create/";
                            AfterInvitePageSourceData = pinterestAccountManager.globusHttpHelper.postFormDataProxyPin(new Uri(postUrlInviteBoard), InviteToBoardPostData, newHomePageUrl);                    
                        }
                        catch (Exception ex)
                        { };
                    }
                    if (!string.IsNullOrEmpty(AfterInvitePageSourceData))
                    {
                        string ModuleName = "AddUserToBoard";
                        string Status = "Invitation Sent";
                        QueryManager qm = new QueryManager();
                        //qm.insertSentInvitation_AddUserToBoard(pinterestAccountManager.Username, ModuleName, BoardName, UserName, Status);
                        qm.insertAccRePort(pinterestAccountManager.Username, ModuleName, "", BoardName, UserName, "", "", "", Status, "", "", DateTime.Now);
                        objAddUserToBoarddelegate();
                        GlobusLogHelper.log.Info(" => [ Invitation sent to " + UserName + " for Board " + BoardName + " ]");
                        return true;
                    }
                    else
                    {
                        GlobusLogHelper.log.Info(" => [  Not Added to Board " + BoardName + " ]");
                        return true;
                    }
                }
                else
                {

                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info(" => [ " + UserName + " Not Added to Board " + BoardName + " ]");
                return true;
            }
            return false;
        }