public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var appMember = new AppMember
                {
                    UserName = model.Email,
                    Email = model.Email,
                    FirstName = model.FirstName,
                    LastName = model.LastName,
                    PictureUrl = "/img/profiles/default.png"
                };

                var result = await userManager.CreateAsync(appMember, model.Password);
                
                if (result.Succeeded)
                {
                    var currentUser = await userManager.FindByNameAsync(model.Email);
                    await userManager.AddToRoleAsync(currentUser.Id, "Autor");
                    //await signInManager.SignInAsync(currentUser, isPersistent: false, rememberBrowser: false);

                    var token = await userManager.GenerateEmailConfirmationTokenAsync(currentUser.Id);
                    var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = currentUser.Id, code = token }, protocol: Request.Url.Scheme);

                    var mailer = new UserMailer();
                    mailer.ConfirmEmail(currentUser, callbackUrl).Send();
                    ViewBag.Email = currentUser.Email;
                    return View("CheckEmail");
                }

                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult Register()
        {
            if(User.Identity.IsAuthenticated)
                return RedirectToRole();

            var model = new RegisterViewModel();

            if (TempData["PreRegisterModel"] != null)
            {
                var preModel = TempData["PreRegisterModel"] as PreRegisterViewModel;
                model.Email = preModel.Email;
            }

            return View(model);
        }