public async Task<IHttpActionResult> Register(UserRegistrationModel model)
        {
            if (!ModelState.IsValid)
                return BadRequest("Data invalid.");

            var newUser = new User
            {
                FirstName = model.FirstName,
                LastName = model.LastName,
                Email = model.Email,
                UserName = model.Email
            };

            var result = await _userManager.CreateAsync(newUser, model.Password);
            var user = _dbContext.Users.FirstOrDefault(u => u.Email == model.Email);
            return Ok(new {result = result.Succeeded, sub = user == null && result.Succeeded ? "" : user.Id});
        }
        public async Task<ActionResult> Register(string signin, UserRegistrationModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            var newUser = new User
            {
                FirstName = model.FirstName,
                LastName = model.LastName,
                Email = model.Email,
                UserName = model.Email
            };

            var result = await _userManager.CreateAsync(newUser, model.Password);
            if (result.Succeeded)
            {
                return Redirect("~/account/details");
            }

            return View(model);
        }