public async Task <IActionResult> RegisterAsync([FromBody] UserDto user, [FromServices] IUserApplicationService service) { try { var registeredUser = await service.CreateUserAsync(user); return(CreatedAtRoute(nameof(GetUserByIdAsync), new { id = registeredUser.Id }, registeredUser)); } catch (Application.Exceptions.ApplicationException ex) { return(BadRequest(ex.ToResult())); } catch (ArgumentException ex) { return(BadRequest(new { reason = ex.Message })); } catch (Exception ex) { Console.WriteLine(ex); return(Problem("Something is not right, calm down calm down! We're working to fix...(I hope so!")); } }