public void Save(ExchangeRate exchangeRate)
 {
     Argument.NotNull(exchangeRate, "");
     EnsureRepositoryException(() =>
     {
         var baseCurrency              = _databaseProvider.CreateParameter();
         baseCurrency.ParameterName    = "@base";
         baseCurrency.DbType           = DbType.String;
         baseCurrency.Value            = exchangeRate.Base.ISOName;
         var foreignCurrency           = _databaseProvider.CreateParameter();
         foreignCurrency.ParameterName = "@foreign";
         foreignCurrency.DbType        = DbType.String;
         foreignCurrency.Value         = exchangeRate.Foreign.ISOName;
         var timestamp           = _databaseProvider.CreateParameter();
         timestamp.ParameterName = "@timestamp";
         timestamp.DbType        = DbType.DateTime;
         timestamp.Value         = exchangeRate.TimestampUtc;
         const string sql        =
             "UPDATE [Processing].[ExchangeRate] SET [IsActual] = 0 " +
             "WHERE [BaseCurrencyISOName] = @base AND [ForeignCurrencyISOName] = @foreign AND [TimestampUtc] < @timestamp";
         Context.Database.ExecuteSqlCommand(TransactionalBehavior.EnsureTransaction, sql, baseCurrency,
                                            foreignCurrency, timestamp);
         Context.Set <ExchangeRate>().Add(exchangeRate);
         return(exchangeRate);
     });
 }