/// <summary>
        /// Gets standings of the tournament specified by identifier.
        /// </summary>
        /// <param name="tournamentId">Identifier of the tournament.</param>
        /// <returns>Standings of the tournament with specified identifier.</returns>
        public TournamentStandings <StandingsDto> GetStandings(int tournamentId)
        {
            var result = new TournamentStandings <StandingsDto>();

            var tournament  = _tournamentByIdQuery.Execute(new FindByIdCriteria(tournamentId));
            var gameResults = _tournamentGameResultsQuery.Execute(new TournamentGameResultsCriteria {
                TournamentId = tournamentId
            });
            Dictionary <(int divisionId, string divisionName), List <TeamTournamentDto> > teamsInTournamentByDivisions = GetTeamsInTournamentByDivisions(tournamentId);

            foreach (var groupedTeams in teamsInTournamentByDivisions)
            {
                var standings = CalculateStandingsForDivision(groupedTeams.Value, gameResults);

                var standingsDto = new StandingsDto
                {
                    DivisionId     = groupedTeams.Key.divisionId,
                    DivisionName   = groupedTeams.Key.divisionName,
                    LastUpdateTime = tournament.LastTimeUpdated,
                    Standings      = standings
                };
                result.Divisions.Add(standingsDto);
            }

            return(result);
        }
 public static DivisionStandingsViewModel Map(StandingsDto standings)
 {
     return(new DivisionStandingsViewModel {
         StandingsEntries = standings.Standings.Select(StandingsEntryViewModel.Map).ToList(),
         LastUpdateTime = standings.LastUpdateTime
     });
 }