public ActionResult Register()
        {
            ViewData["PasswordLength"] = MembershipService.MinPasswordLength;

            var model = new RegisterModel { Brands = GetBrands() };

            return View(model);
        }
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                var brandRepo = new BrandRepository();
                var brand = brandRepo.GetByBrandId(model.BrandId);

                if (brand.Password != model.BrandPassword)
                {
                    ModelState.AddModelError("", "Incorrect brand password");
                }
                else
                {
                    // Attempt to register the user
                    var createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email, model.BrandId);

                    if (createStatus == MembershipCreateStatus.Success)
                    {
                        FormsService.SignIn(model.UserName, false);
                        return RedirectToAction("Index", "Catalog");
                    }

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

            // If we got this far, something failed, redisplay form
            ViewData["PasswordLength"] = MembershipService.MinPasswordLength;
            model.Brands = GetBrands();

            return View(model);
        }