private void InitDefaultUsersAndRoles(UserManager<QuestionsAnswersUser> userManager,
			RoleManager<IdentityRole> roleManager)
		{
			if (roleManager.FindByName("admin") == null)
			{
				roleManager.Create(new IdentityRole("admin"));
			}

			if (roleManager.FindByName("user") == null)
			{
				roleManager.Create(new IdentityRole("user"));
			}

			if (userManager.FindByName("admin") == null)
			{
				var user = new QuestionsAnswersUser {UserName = "******"};
				var result = userManager.Create(user, "adminadmin");
				if (result.Succeeded)
				{
					userManager.AddToRole(user.Id, "admin");
				}
			}

			userManager.Users.Where(u => !u.Roles.Any()).ToList().ForEach(u => userManager.AddToRole(u.Id, "user"));
		}
		public async Task<ActionResult> Register(RegisterViewModel model)
		{
			if (ModelState.IsValid)
			{
				var user = new QuestionsAnswersUser {UserName = model.UserName};
				var result = await UserManager.CreateAsync(user, model.Password);
				if (result.Succeeded)
				{
					await UserManager.AddToRoleAsync(user.Id, "user");
					await SignInAsync(user, false);
					return RedirectToAction("Index", "Home");
				}
				AddErrors(result);
			}

			// If we got this far, something failed, redisplay form
			return View(model);
		}
		private async Task SignInAsync(QuestionsAnswersUser user, bool isPersistent)
		{
			AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
			var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
			AuthenticationManager.SignIn(new AuthenticationProperties {IsPersistent = isPersistent}, identity);
		}