public async Task <IActionResult> SignIn([FromBody] LoginModel model)
        {
            var user = await _userManager.FindByEmailAsync(model.Email);

            if (user == null)
            {
                ModelState.AddModelError("email", $"No user exists with email {model.Email}");
                return(BadRequest(ModelState));
            }
            var result = await _signInManager.CheckPasswordSignInAsync(user, model.Password, false);

            if (result.Succeeded)
            {
                var token = await _tokenHandler.GenerateTokenForUser(user, expiry : DateTime.Now.AddDays(20));

                return(Ok(new { token, user.UserName }));
            }
            ModelState.AddModelError("password", $"Invalid password");
            return(BadRequest(ModelState));
        }