public ActionResult Register(RegisterAccountViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid) { return View(model); }

            var request = model.ConvertToRegisterUserLoginRequest();

            var response = _membershipService.RegisterUserLogin(request);

            if (response.UserLogin.IsAuthenticated)
            {
                var authCookie = SetRegistrationCookie(response);

                Response.Cookies.Add(authCookie);

                return RedirectToLocal(returnUrl);
            }

            model.HasIssues = true;

            model.ErrorMessage = !string.IsNullOrEmpty(response.ErrorMessage)
                ? response.ErrorMessage
                : "Sorry we could not authenticate you.  Please try again.";

            return View(model);
        }
        public ActionResult Register()
        {
            string returnUrl = null;

            if (Request.UrlReferrer != null)
            {
                returnUrl = HttpUtility.ParseQueryString(Request.UrlReferrer.Query)["ReturnUrl"];
            }

            var model = new RegisterAccountViewModel
            {
                ReturnUrl = returnUrl,
                HasIssues = false,
                ErrorMessage = string.Empty
            };

            return View(model);
        }