internal static IEnumerable <Athlete> GetDataFromDB(IDbContextFactory <WeightliftingContext> contextFactory, AthletePanel athletePanel)
        {
            using var context = contextFactory.CreateDbContext();
            var resultAthletes = context.Athletes.Where(athlete => (athletePanel.Name == null || athlete.Name == athletePanel.Name) &&
                                                        (athletePanel.Country == null || athlete.Country.Name == athletePanel.Country) &&
                                                        (athletePanel.MenIsIncluded && athletePanel.WomenIsIncluded ||
                                                         (athletePanel.MenIsIncluded ? athlete.Sex == Men : athletePanel.WomenIsIncluded && athlete.Sex == Women)))
                                 .Select(athlete => new Athlete
            {
                Country = athlete.Country.Name,
                DOB     = athlete.BirthDate.ToString(),
                Name    = athlete.Name,
                Sex     = athlete.Sex
            });

            return(resultAthletes.ToArray());
        }
 public IEnumerable <Athlete> FindData(AthletePanel athletePanel)
 {
     return(SearchHelper.GetDataFromDB(_contextFactory, athletePanel));
 }