public void saveDailyExchangeRate(ExchangeRate e) throws CantSaveExchangeRateException {

    // Create new exchangeRate with standarized daily timestamp
    e =
        new ExchangeRateImpl(
            e.getFromCurrency(),
            e.getToCurrency(),
            e.getSalePrice(),
            e.getPurchasePrice(),
            DateHelper.getStandarizedTimestampFromTimestamp(e.getTimestamp()));

    // If it exists, return
    if (this.dailyExchangeRateExists(e)) return;

    // Else, save it
    DatabaseTable table =
        this.database.getTable(
            BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_TABLE_NAME);
    DatabaseTableRecord newRecord = table.getEmptyRecord();
    constructRecordFromExchangeRate(newRecord, e);
    try {
      table.insertRecord(newRecord);
    } catch (CantInsertRecordException ex) {
      throw new CantSaveExchangeRateException(
          CantSaveExchangeRateException.DEFAULT_MESSAGE,
          ex,
          "BitcoinVenezuela provider plugin",
          "Cant save new record in DAILY_EXCHANGE_RATES_TABLE");
    }
  }
 public boolean dailyExchangeRateExists(ExchangeRate e) {
   try {
     getDailyExchangeRateFromDate(
         new CurrencyPairImpl(e.getFromCurrency(), e.getToCurrency()), e.getTimestamp());
     return true;
   } catch (CantGetExchangeRateException ex) {
     return false;
   }
 }
  private void constructRecordFromExchangeRate(
      DatabaseTableRecord newRecord, ExchangeRate exchangeRate) {

    newRecord.setUUIDValue(
        BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_ID_COLUMN_NAME,
        UUID.randomUUID());
    newRecord.setStringValue(
        BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_FROM_CURRENCY_COLUMN_NAME,
        exchangeRate.getFromCurrency().getCode());
    newRecord.setStringValue(
        BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_TO_CURRENCY_COLUMN_NAME,
        exchangeRate.getToCurrency().getCode());
    newRecord.setStringValue(
        BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_SALE_PRICE_COLUMN_NAME,
        String.valueOf(exchangeRate.getSalePrice()));
    newRecord.setStringValue(
        BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_PURCHASE_PRICE_COLUMN_NAME,
        String.valueOf(exchangeRate.getPurchasePrice()));
    newRecord.setLongValue(
        BitcoinVenezuelaProviderDatabaseConstants.DAILY_EXCHANGE_RATES_TIMESTAMP_COLUMN_NAME,
        exchangeRate.getTimestamp());
  }