private static Money calculateBaseAmount(Money amount, IList<IHistoricalExRate> exrates, DateTime date) { if (!((ICurrency)amount.Underlying).IsBase) { if (Util.IsNotNullDate(date)) { IHistoricalExRate exrate = exrates.Where(x => x.Currency.Key == amount.Underlying.Key && x.RateDate == date).FirstOrDefault(); if (exrate == null) throw new ApplicationException(string.Format("Exchange rate for {0} on {1} is missing.", ((ICurrency)amount.Underlying).Symbol, date.ToShortDateString())); Money convAmt = amount.ConvertToBase(1M/exrate.Rate); return convAmt; } else return amount.CurrentBaseAmount; } else return amount; }