public async Task <IActionResult> Register([FromBody] RegisterModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var user = Mapper.Map <RegisterModel, User>(model);

            if (!string.IsNullOrEmpty(model.ProfileImage))
            {
                model.CreateImage(ImagesPath, out var profileImageUrl);
                user.ProfileImageUrl = $"{Request.Scheme}://{Request.Host}/{profileImageUrl}";
            }

            var result = await CreateUserAsync(user, model.Password);

            if (result.Succeeded)
            {
                return(Ok());
            }
            return(BadRequest(result.Errors.ToDictionary(e => e.Code, e => e.Description)));
        }