public async Task <long> CreateGame(long playerId, int amountOfBots) { var game = new Game(); game.Id = await _gameRepository.Create(game); List <Player> players = await CreatePlayerList(playerId, amountOfBots); var gamePlayers = new List <GamePlayer>(); foreach (Player player in players) { GamePlayer gamePlayer = CustomMapper.GetGamePlayer(player, game.Id); gamePlayers.Add(gamePlayer); } await _gamePlayerRepository.CreateMany(gamePlayers, ToStringHelper.GetTableName(typeof(GamePlayer))); List <Log> logs = LogHelper.GetCreationGameLogs(gamePlayers, game); await _logRepository.CreateMany(logs, ToStringHelper.GetTableName(typeof(Log))); long gameId = game.Id; return(gameId); }