public IList <ForeignExchangeRateModel> ToForeignExchangeRateModels(ForeignExchangeRateDto foreignExchangeRateDto, string date) { if (foreignExchangeRateDto == null || ListExtensions.IsNullOrEmpty(foreignExchangeRateDto.TargetCurrencies)) { return(new List <ForeignExchangeRateModel>()); } var dateAsInt = GetDateAsInt(foreignExchangeRateDto.PublicationDate); if (dateAsInt.ToString() != date) { return(new List <ForeignExchangeRateModel>()); } var rates = new List <ForeignExchangeRateDto> { foreignExchangeRateDto }; return(rates.SelectMany(rate => rate.TargetCurrencies, (r, c) => new ForeignExchangeRateModel { Id = Guid.NewGuid(), Date = dateAsInt, BaseCurrency = TextExtensions.ToEnglishUpper(r.BaseCurrency), TargetCurrency = TextExtensions.ToEnglishUpper(c.TargetCurrency), InverseRate = ConvertExtensions.ToDecimal(c.InverseRate), PublicationDate = r.PublicationDate }).ToList()); }