public Species MapFrom(FlatSpecies flatSpecies) { var species = new Species { Id = flatSpecies.Id, Name = flatSpecies.Id, Icon = flatSpecies.IconName }; foreach (var population in _populationRepository.All().Where(pop => pop.Species == flatSpecies.Id).OrderBy(x => x.Sequence)) { species.AddPopulation(population); } foreach (var pvvCategory in _pvvCategoriesMapper.MapFrom(_flatParameterValueVersionRepository.All(), flatSpecies.Id)) { species.AddPVVCategory(pvvCategory); } return(species); }