public ActionResult Register(AccountRegisterViewModel model)
        {
            if (ModelState.IsValid) {
                var createStatus = _authenticationService.RegisterUser(model.Email, model.Password);

                if (createStatus == MembershipCreateStatus.Success) {
                    var profile = new UserProfile
                                      {
                                          FirstName = model.UserProfile.FirstName,
                                          LastName = model.UserProfile.LastName,
                                          Country = model.UserProfile.Country,
                                          Address = model.UserProfile.Address,
                                          City = model.UserProfile.City,
                                          PostalCode = model.UserProfile.PostalCode
                                      };

                    _personalizationService.UpdateProfile(model.Email, profile);
                    _authorizationService.AddUserToRole(model.Email, CustomRoleProvider.Roles.Customer);

                    _authenticationService.SignIn(model.Email, false /* createPersistentCookie */);

                    var shoppingCart = GetShoppingCart();
                    if (shoppingCart != null) {
                        _shoppingCartService.MigrateShoppingCart(model.Email, shoppingCart);

                        HttpContext.Session.Remove(ShoppingCartService.CartSessionKey);
                    }

                    return RedirectToAction("List", "Movies");
                }

                ModelState.AddModelError("", AuthenticationService.AccountValidation.ErrorCodeToString(createStatus));
            }

            return View(model);
        }
        public void Registers_user_when_provided_correct_parameters()
        {
            const string email = "Email1!2";
            const string password = "******";
            var profile = new UserProfile
                              {
                                  Address = "address",
                                  City = "city",
                                  Country = "Country",
                                  FirstName = "FirstName",
                                  LastName = "LastName",
                                  PostalCode = "12345"
                              };

            var viewModel = new AccountRegisterViewModel
                                {
                                    Email = email,
                                    Password = password,
                                    ConfirmPassword = password,
                                    UserProfile = profile
                                };

            var user = FakeAuthenticationService.Users.SingleOrDefault(x => x.Email == email);
            Assert.IsNull(user);

            _accountController.Register(viewModel);

            user = FakeAuthenticationService.Users.SingleOrDefault(x => x.Email == email);
            Assert.IsNotNull(user);
        }