public ActionResult Register(UserViewModel objUserViewModel) { ApplicationDBContext objApplicationDBContext = new ApplicationDBContext(); Models.User objUser = new Models.User(); objUserViewModel.ApplyToModel(ref objUser); objUser.Password = PasswordHasher.GenerateHashForUser(objUserViewModel.Password); objApplicationDBContext.Users.Add(objUser); objApplicationDBContext.SaveChanges(); objApplicationDBContext.ProductCategories.AddRange(Constants.GetPreDefinedCategories(objUser)); objApplicationDBContext.SaveChanges(); objUser.Bills = new List <Bill>(); SessionManager.SetCurrentUser(objUser); return(RedirectToAction("Index", "Home")); }