public async Task <IActionResult> Create([FromBody] CreateDto_Game newGame) { try { if (!ModelState.IsValid) { return(BadRequest(new ErrorResponse(ModelState))); } var createdGame = await _gameService.CreateAsync(newGame); await _gameService.AddCollaboratorAsync(createdGame, newGame.UserId); await _gameService.SaveChangesAsync(); var dtoGame = Mapper.Map <Dto_Game>(createdGame); return(StatusCode(StatusCodes.Status201Created, dtoGame)); } catch (NotFoundException ex) { return(NotFound(new ErrorResponse(ex))); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError)); } }