private static Race FindOrCreateRace(HorseSenseContext context, RaceDay raceday, RaceDay parsedRaceday)
        {
            Race race = null;

            foreach (var raceItem in raceday.Races)
            {
                if (raceItem.RaceNum == parsedRaceday.Races.First <Race>().RaceNum)
                {
                    race = raceItem;
                    return(race);
                }
            }

            if (parsedRaceday.Races != null && parsedRaceday.Races.Count > 0)
            {
                race = parsedRaceday.Races.First <Race>();
                raceday.Races.Add(race);
                context.Add(race);
                return(race);
            }
            else
            {
                return(null);
            }
        }
        private static Horse FindOrCreateHorse(HorseSenseContext context, Race race, RaceDay parsedRaceday)
        {
            Horse horse = null;

            foreach (var horseItem in race.Horses)
            {
                if (horseItem.PostPos == parsedRaceday.Races.First <Race>().Horses.First <Horse>().PostPos)
                {
                    horse = horseItem;
                    return(horse);
                }
            }


            if (parsedRaceday.Races != null &&
                parsedRaceday.Races.First <Race>().Horses != null &&
                parsedRaceday.Races.First <Race>().Horses.Count > 0)
            {
                horse = parsedRaceday.Races.First <Race>().Horses.First <Horse>();
                race.Horses.Add(horse);
                context.Add(horse);
                return(horse);
            }
            else
            {
                return(null);
            }
        }
        private static RaceDay FindOrCreateRaceDay(HorseSenseContext context, RaceDay parsedRaceday)
        {
            RaceDay raceDay = context.RaceDays
                              .Include(rd => rd.Races)
                              .ThenInclude(r => r.Horses)
                              .FirstOrDefault(rd => rd.Track.Equals(parsedRaceday.Track) && rd.Date.Equals(parsedRaceday.Date));

            if (raceDay == null)
            {
                raceDay = new RaceDay
                {
                    Track = parsedRaceday.Track,
                    Date  = parsedRaceday.Date
                };

                context.Add(raceDay);
            }

            return(raceDay);
        }