static void TeamExistanceCheck(FootballEntities context, string teamName, string countryName)
 {
     if (!context.Teams.Any(t => t.TeamName == teamName && t.Country.CountryName == countryName))
     {
         context.Teams.Add(new Team()
         {
             TeamName = teamName,
             Country = context.Countries.Where(c => c.CountryName == countryName).FirstOrDefault()
         });
         context.SaveChanges();
         Console.WriteLine("Created team: {0} ({1})", teamName,
             (countryName == null ? "no country" : countryName));
     }
     else
     {
         Console.WriteLine("Existing team: {0} ({1})", teamName,
             (countryName == null ? "no country" : countryName));
     }
 }
        static void TeamInLeagueExistanceCheck(FootballEntities context, string leagueName, string teamCountryName, string teamName)
        {
            var currentLeague = context.Leagues.Where(l => l.LeagueName == leagueName).FirstOrDefault();

            if (currentLeague != null)
            {
                if (teamCountryName != null)
                {
                    if (!currentLeague.Teams.Any(t => t.TeamName == teamName && t.Country.CountryName == teamCountryName))
                    {
                        currentLeague.Teams.Add(
                            context.Teams.Where(t => t.TeamName == teamName && t.Country.CountryName == teamCountryName).FirstOrDefault());
                        Console.WriteLine("Added team to league: {0} to league {1}", teamName, leagueName);
                    }
                    else
                    {
                        Console.WriteLine("Existing team in league: {0} belongs to {1}", teamName, leagueName);
                    }
                }
                else
                {
                    if (!currentLeague.Teams.Any(t => t.TeamName == teamName))
                    {
                        currentLeague.Teams.Add(
                            context.Teams.Where(t => t.TeamName == teamName).FirstOrDefault()); 
                        context.SaveChanges();
                        Console.WriteLine("Added team to league: {0} to league {1}", teamName, leagueName);
                    }
                    else
                    {
                        Console.WriteLine("Existing team in league: {0} belongs to {1}", teamName, leagueName);
                    }
                }
            }
        }
 static void LeagueExistanceCheck(FootballEntities context, string leagueName)
 {
     if (!context.Leagues.Any(l => l.LeagueName == leagueName))
     {
         context.Leagues.Add(new League()
         {
             LeagueName = leagueName
         });
         context.SaveChanges();
         Console.WriteLine("Created league: {0}", leagueName);
     }
     else
     {
         Console.WriteLine("Existing league: {0}", leagueName);
     }
 }