public static void GetUserTeamH2hLeagueJson(int userTeamId, UserTeam userTeam, UserTeamH2hLeagues userTeamH2hLeaguesInsert, SqlConnection db)
        {
            try
            {
                //Load H2hLeague data
                UserTeamH2hLeagueRepository h2hLeagueRepository = new UserTeamH2hLeagueRepository();

                List <int> h2hLeagueIds = h2hLeagueRepository.GetAllH2hLeagueIdsForUserTeamId(userTeamId, db);

                foreach (UserTeamH2hLeague h2hLeague in userTeam.leagues.h2h)
                {
                    //needed if want to assign value from parent to add into db table
                    h2hLeague.userteamid = userTeamId;

                    if (!h2hLeagueIds.Contains(h2hLeague.id) && !userTeamH2hLeaguesInsert.Contains(h2hLeague))
                    {
                        //h2hLeagueRepository.InsertUserTeamH2hLeague(h2hLeague, db);
                        userTeamH2hLeaguesInsert.Add(h2hLeague);
                    }
                    //NEED TO ADD BACK IN WHEN RERUNNING OR WILL NOT UPDATE LEAGUES
                    //else
                    //{
                    //    h2hLeagueRepository.UpdateUserTeamH2hLeague(h2hLeague);
                    //}
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetUserTeamH2hLeagueJson data exception (UserTeamId: " + userTeamId.ToString() + "): " + ex.Message);
                throw new Exception("GetUserTeamH2hLeagueJson data exception (UserTeamId: " + userTeamId.ToString() + "): " + ex.Message);
            }
        }
 private static int WriteUserTeamH2hLeagueToDB(UserTeamH2hLeagues userTeamH2hLeaguesInsert, SqlConnection db)
 {
     try
     {
         UserTeamH2hLeagueRepository userTeamH2hLeagueRepository = new UserTeamH2hLeagueRepository();
         int userTeamH2hLeagueRowsInserted = userTeamH2hLeagueRepository.InsertUserTeamH2hLeague(userTeamH2hLeaguesInsert, db);
         return(userTeamH2hLeagueRowsInserted);
     }
     catch (Exception ex)
     {
         Logger.Error("Program WriteUserTeamH2hLeagueToDB error: " + ex.Message);
         return(0);
     }
 }
        public static void WriteUserTeamH2hLeagueToDB(int pageId, UserTeamH2hLeagues userTeamH2hLeaguesInsert, SqlConnection db)
        {
            try
            {
                UserTeamH2hLeagueRepository userTeamH2hLeagueRepository = new UserTeamH2hLeagueRepository();

                //Write UserTeamH2hLeague to the db
                Globals.UserTeamH2hLeagueRowsInserted = userTeamH2hLeagueRepository.InsertUserTeamH2hLeague(userTeamH2hLeaguesInsert, db);
                Logger.Out("UserTeamH2hLeague bulk insert complete (PageId: " + Convert.ToString(pageId) + ")");

                userTeamH2hLeaguesInsert.Clear();
            }
            catch (Exception ex)
            {
                Logger.Error("Program WriteUserTeamH2hLeagueToDB error: " + ex.Message);
            }
        }