public async Task <IActionResult> AddNewPlayer([FromBody] Player player) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await playerService.AddNewPlayerAsync(player); return(CreatedAtAction("GetById", new { id = player.TeamId }, player)); } catch (NotFoundInDatabaseException) { return(NotFound()); } catch (AlreadyInDatabaseException) { return(Conflict()); } catch (Exception e) { return(BadRequest(e.Message)); } }