private async Task GiveCards(int count, long playerId, long sessionId) { IEnumerable <Card> cards = await _cardManager.GetRandomCards(count); IEnumerable <long> cardIds = cards.Select(c => c.Id); await _playerManager.GiveCardsToPlayer(playerId, sessionId, cardIds); var historyMessages = new List <History>(); foreach (var card in cards) { var historyMessage = new History { PlayerId = playerId, SessionId = sessionId, Event = UserMessages.GetPlayerTakesCardMessage( EnumHelper.GetCardRankName(card.Rank), card.Suit.ToString()) }; historyMessages.Add(historyMessage); } await _historyManager.Create(historyMessages); }