public static List<MetaPlayer> GetPlayers(Guid tournamentId, PairsAlgorithmType type)
        {
            IPairsAlgo algorithm = PairsAlgo.PairsAlgorithmFactory(type);
            List<MetaPlayer> listPlayers = algorithm.Execute(tournamentId);

            return listPlayers;
        }
        public static List<PlayersEntity> BuildPairs(Guid tournamentId, PairsAlgorithmType type, PairsMatchType pairsMatchingType, int numOfRounds)
        {
            List<MetaPlayer> listPlayers = GetPlayers(tournamentId, type);
            List<PlayersEntity> pairs = BuildPairs(tournamentId, pairsMatchingType, listPlayers, numOfRounds);
            //match up

            return pairs;
        }
 private static IPairsAlgo PairsAlgorithmFactory(PairsAlgorithmType type)
 {
     switch (type)
     {
         case PairsAlgorithmType.Alphabetical:
             return new AlphabeticalPairs();
         case PairsAlgorithmType.Random:
             return new RandomPairs();
         default:
             return new AlphabeticalPairs();
     }
 }
 public static List<PlayersEntity> BuildPairs(Guid tournamentId, PairsAlgorithmType type, PairsMatchType pairsMatchingType)
 {
     return BuildPairs(tournamentId, type, pairsMatchingType, 1);
 }
        //internal static void ScheduleGames(Guid orgId, Guid tournaId)
        //{
        //    //Get tourna startDate
        //    DateTime startDate = new DateTime();
        //    using (TournaDataContext db = new TournaDataContext())
        //    {
        //         startDate  = db.Tournaments.Where(x => x.Id == tournaId)
        //                                           .Select(y => y.StartDate)
        //                                           .FirstOrDefault() ?? new DateTime();
        //    }
        //    ScheduleGames(orgId, tournaId, startDate);
        //}
        internal static void ScheduleGames(Guid orgId, Guid tournaId, DateTime startDate, PairsMatchType matchType, PairsAlgorithmType pairAlgo)
        {
            TournamentInfo info = new TournamentInfo()
            {
                TournamentId = tournaId,
                OrganisationId = orgId,
                StartDate = startDate,
                MatchType = matchType,
                PairAlgo = pairAlgo
            };

            ScheduleGames(info);
        }