public static void WriteUserTeamChipToDB(int pageId, UserTeamChips userTeamChipsInsert, SqlConnection db)
        {
            try
            {
                UserTeamChipRepository userTeamChipRepository = new UserTeamChipRepository();

                //Write UserTeamChip to the db
                Globals.UserTeamChipRowsInserted = userTeamChipRepository.InsertUserTeamChip(userTeamChipsInsert, db);
                Logger.Out("UserTeamChip bulk insert complete (PageId: " + Convert.ToString(pageId) + ")");

                userTeamChipsInsert.Clear();
            }
            catch (Exception ex)
            {
                Logger.Error("Program WriteUserTeamChipToDB error: " + ex.Message);
            }
        }
        public static void WriteToDB(UserTeams userTeamInsert, UserTeamGameweekHistories userTeamGameweekHistoriesInsert, UserTeamChips userTeamChipsInsert, UserTeamSeasons userTeamSeasonsInsert, UserTeamClassicLeagues userTeamClassicLeaguesInsert, UserTeamH2hLeagues userTeamH2hLeaguesInsert, SqlConnection db)
        {
            try
            {
                int userTeamRowsInserted = 0;
                int userTeamGameweekHistoryRowsInserted = 0;
                int userTeamChipRowsInserted            = 0;
                int userTeamSeasonRowsInserted          = 0;
                int userTeamClassicLeagueRowsInserted   = 0;
                int userTeamH2hLeagueRowsInserted       = 0;

                //Write UserTeam to the db
                userTeamRowsInserted = WriteUserTeamToDB(userTeamInsert, db);
                //userTeamRowsInserted = userTeamRepository.InsertUserTeam(userTeamInsert, db);

                //Write UserTeamChip to the db
                userTeamChipRowsInserted = WriteUserTeamChipToDB(userTeamChipsInsert, db);
                //userTeamChipRowsInserted = userTeamChipRepository.InsertUserTeamChip(userTeamChipsInsert, db);

                //Write UserTeamGameweekHistory to the db
                userTeamGameweekHistoryRowsInserted = WriteUserTeamGameweekHistoryToDB(userTeamGameweekHistoriesInsert, db);
                //userTeamGameweekHistoryRowsInserted = userTeamGameweekHistoryRepository.InsertUserTeamGameweekHistories(userTeamGameweekHistoriesInsert, db);

                //Write UserTeamSeason to the db
                userTeamSeasonRowsInserted = WriteUserTeamSeasonToDB(userTeamSeasonsInsert, db);
                //userTeamSeasonRowsInserted = userTeamSeasonRepository.InsertUserTeamSeason(userTeamSeasonsInsert, db);

                //Write UserTeamClassicLeague to the db
                userTeamClassicLeagueRowsInserted = WriteUserTeamClassicLeagueToDB(userTeamClassicLeaguesInsert, db);
                //userTeamClassicLeagueRowsInserted = userTeamClassicLeagueRepository.InsertUserTeamClassicLeague(userTeamClassicLeaguesInsert, db);

                //Write UserTeamH2hLeague to the db
                userTeamH2hLeagueRowsInserted = WriteUserTeamH2hLeagueToDB(userTeamH2hLeaguesInsert, db);
                //userTeamH2hLeagueRowsInserted = userTeamH2hLeagueRepository.InsertUserTeamH2hLeague(userTeamH2hLeaguesInsert, db);

                Logger.Out("");
                Logger.Out("UserTeam bulk insert complete (UserTeam rows inserted: " + Convert.ToString(userTeamRowsInserted) + ")");
                Logger.Out("UserTeamGameweekHistory bulk insert complete (UserTeamGameweekHistory rows inserted: " + Convert.ToString(userTeamGameweekHistoryRowsInserted) + ")");
                Logger.Out("UserTeamChip bulk insert complete (UserTeamChip rows inserted: " + Convert.ToString(userTeamChipRowsInserted) + ")");
                Logger.Out("UserTeamSeason bulk insert complete (UserTeamSeason rows inserted: " + Convert.ToString(userTeamSeasonRowsInserted) + ")");
                Logger.Out("UserTeamClassicLeague bulk insert complete (UserTeamClassicLeague rows inserted: " + Convert.ToString(userTeamClassicLeagueRowsInserted) + ")");
                Logger.Out("UserTeamH2hLeague bulk insert complete (UserTeamH2hLeague rows inserted: " + Convert.ToString(userTeamH2hLeagueRowsInserted) + ")");
                Logger.Out("");

                Logger.Out("API UserTeam calls: " + Convert.ToString(Globals.apiUserTeamCalls));
                Logger.Out("API UserTeamHistory calls: " + Convert.ToString(Globals.apiUserTeamHistoryCalls));
                Logger.Out("API calls: " + Convert.ToString(Globals.apiCalls));
                Logger.Out("");

                userTeamInsert.Clear();
                userTeamGameweekHistoriesInsert.Clear();
                userTeamChipsInsert.Clear();
                userTeamSeasonsInsert.Clear();
                userTeamClassicLeaguesInsert.Clear();
                userTeamH2hLeaguesInsert.Clear();

                Globals.apiCalls                = 0;
                Globals.apiUserTeamCalls        = 0;
                Globals.apiUserTeamHistoryCalls = 0;
                Globals.userTeamInsertCount     = 0;
            }
            catch (Exception ex)
            {
                Logger.Error("Program WriteToDB error: " + ex.Message);
                //WriteToDB(userTeamRowsInserted, userTeamSeasonRowsInserted, userTeamInsert, userTeamSeasonsInsert, db);
            }
        }