//todo:need to refactor and has grouping bag
        public IEnumerable <PlayerSummary> GetPlayerSummariesByName(string name)
        {
            if (!OponentNames.Contains(name))
            {
                throw new Exception(string.Format("Player with name {0} is not found!", name));
            }
            var playerGames = _context.Games.GetGamesForPlayer(name).ToList(); //* 2 qs
            var limits      = playerGames.GetDistinctLimits();                 //* 1qs

            foreach (var limit in limits)
            {
                SeatType l = limit;
                var      limitPlayerGames = playerGames.GetGamesForLimit(l);
                var      handsWon         = _context.HandActions.GetWonActionsCountForPlayer(name);

                var sessionGroups = from lg in limitPlayerGames
                                    group lg by new { lg.TableName, lg.DateOfHand.Date };

                var playerSummary = new PlayerSummary
                {
                    Name     = name,
                    Limit    = limit,
                    Hands    = limitPlayerGames.Count(),
                    HandsWon = handsWon,
                    Sessions = sessionGroups.Count()
                };
                playerSummary.HandsWonPercent =
                    decimal.Round((decimal)playerSummary.HandsWon / (decimal)playerSummary.Hands * 100, 2);
                yield return(playerSummary);
            }
        }
        //todo:need to refactor and has grouping bag
        public IEnumerable<PlayerSummary> GetPlayerSummariesByName(string name)
        {
            if(!OponentNames.Contains(name))
                throw new Exception(string.Format("Player with name {0} is not found!", name));
            var playerGames = _context.Games.GetGamesForPlayer(name).ToList();//* 2 qs
            var limits = playerGames.GetDistinctLimits();//* 1qs
            foreach (var limit in limits)
            {
                SeatType l = limit;
                var limitPlayerGames = playerGames.GetGamesForLimit(l);
                var handsWon = _context.HandActions.GetWonActionsCountForPlayer(name);

                var sessionGroups = from lg in limitPlayerGames
                    group lg by new {lg.TableName, lg.DateOfHand.Date};

                var playerSummary = new PlayerSummary
                {
                    Name = name,
                    Limit = limit,
                    Hands = limitPlayerGames.Count(),
                    HandsWon = handsWon,
                    Sessions = sessionGroups.Count()
                };
                playerSummary.HandsWonPercent =
                    decimal.Round((decimal) playerSummary.HandsWon/(decimal) playerSummary.Hands*100, 2);
                yield return playerSummary;
            }
        }