public IActionResult Create(int hostId, int guestId, string matchDate, string matchPlace, int[] hostPlayerIDs, int[] guestPlayerIDs)
        {
            int    minPlayers    = 6;
            Status defaultStatus = _matchRepository.DefaultStatus();
            // Validate date
            DateTime date;

            if (!DateTime.TryParse(matchDate, out date) || DateTime.Compare(DateTime.Today.Date, date.Date) > 0)
            {
                return(Json(false));
            }
            // Validate other fields
            if (hostId == guestId || hostPlayerIDs.Count() != guestPlayerIDs.Count() || hostPlayerIDs.Count() < minPlayers || guestPlayerIDs.Count() < minPlayers || matchPlace == null || matchPlace.Length == 0)
            {
                return(Json(false));
            }
            // Create new match
            Match newMatch = new Match()
            {
                HostTeamId  = hostId,
                GuestTeamId = guestId,
                HostScore   = 0,
                GuestScore  = 0,
                Date        = date,
                Place       = matchPlace,
                StatusId    = defaultStatus.Id
            };

            _matchRepository.Add(newMatch);
            _matchRepository.Save();
            // Add host players
            foreach (int hostPlayerId in hostPlayerIDs)
            {
                MatchPlayer playerOnMatch = new MatchPlayer()
                {
                    MatchId  = newMatch.Id,
                    PlayerId = hostPlayerId
                };
                _matchRepository.AddMatchPlayer(playerOnMatch);
            }
            // Add guest players
            foreach (int guestPlayerId in guestPlayerIDs)
            {
                MatchPlayer playerOnMatch = new MatchPlayer()
                {
                    MatchId  = newMatch.Id,
                    PlayerId = guestPlayerId
                };
                _matchRepository.AddMatchPlayer(playerOnMatch);
            }
            _matchRepository.Save();

            return(Json(true));
        }