public ActionResult ConfirmEmail(string id, string portal, string ClientID, string ReturnURL)
        {

            Guid actionguid = new Guid();

            try
            {
                actionguid = new Guid(id);
            }
            catch (FormatException)
            {
                ViewData.ModelState.AddModelError("emailSuccess", "The link you used to navigate to this page is not valid.");
            }

            if (String.IsNullOrEmpty(id))
            {
                ViewData.ModelState.AddModelError("emailSuccess", "The link you used to navigate to this page is no longer valid.");

            }


            if (ViewData.ModelState.IsValid)
            {
                var db = new UsersDataContext();
                var result = db.S1_Users_VerifyEmail(id).SingleOrDefault();

                if (result != null)
                {
                    if (result.IsActive == 0)
                    {

                            var db2 = new UsersDataContext();
                            var result2 = db.S1_Users_InactivateMessageAction(actionguid);

                            if (result2 >= 0)
                            {
                                ViewData["ReturnUrl"] = result.MessageActionPath + "?UserName="******"emailSuccess"] = "Your account has been activated!  You will be redirected automatically in about 5 seconds...";
                            }

                    }
                    else
                    {
                        ViewData["ReturnUrl"] = result.MessageActionPath;
                        ViewData.ModelState.AddModelError("emailSuccess", "This account has already been activated.");
                    }
                }
                else
                {
                    ViewData.ModelState.AddModelError("emailSuccess", "The link you used to navigate to this page is no longer valid.");

                }

            }

            return View();
        }