internal static void ScheduleGames(ref List<Matchup> matchups, DateTime dts, TimeSpan timeWindowStart, int gamesPerDay, Guid orgId, int openDaysBitMask) { int numberOfGamesCounter = 1; int minutesPerGame = 15; CultureManager cultureManager = new CultureManager(orgId, openDaysBitMask); IEnumerator<DateTime> dayEnumerator = cultureManager.GetNextBusinessDay(dts).GetEnumerator(); DateTime dt; int currentRound = 0; foreach (Matchup mu in matchups) { if (numberOfGamesCounter == gamesPerDay || mu.Round != currentRound) { dayEnumerator.MoveNext(); dts = dayEnumerator.Current; dts = new DateTime(dts.Year, dts.Month, dts.Day); dts = dts.Add(timeWindowStart); numberOfGamesCounter = 0; } mu.Start = dts; numberOfGamesCounter++; dts = dts.AddMinutes(minutesPerGame); mu.End = dts; currentRound = mu.Round; } }