@Override
  public Collection<LoanProductData> retrieveAllLoanProducts() {

    AppUser currentUser = this.context.authenticatedUser();
    // TODO - include currency read in the sql
    List<CurrencyData> allowedCurrencies =
        currencyReadPlatformService.retrieveAllPlatformCurrencies();

    LoanProductMapper rm = new LoanProductMapper(allowedCurrencies);

    String sql = "select " + rm.loanProductSchema() + " where lp.org_id = ?";

    return this.jdbcTemplate.query(sql, rm, new Object[] {currentUser.getOrganisation().getId()});
  }
  @Override
  public LoanProductData retrieveLoanProduct(final Long loanProductId) {

    try {
      List<CurrencyData> allowedCurrencies =
          currencyReadPlatformService.retrieveAllPlatformCurrencies();

      LoanProductMapper rm = new LoanProductMapper(allowedCurrencies);
      String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";

      LoanProductData productData =
          this.jdbcTemplate.queryForObject(sql, rm, new Object[] {loanProductId});

      populateProductDataWithDropdownOptions(productData);

      return productData;
    } catch (EmptyResultDataAccessException e) {
      throw new LoanProductNotFoundException(loanProductId);
    }
  }
  private void populateProductDataWithDropdownOptions(LoanProductData productData) {

    List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
    List<EnumOptionData> amortizationTypeOptions =
        dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
    List<EnumOptionData> interestTypeOptions =
        dropdownReadPlatformService.retrieveLoanInterestTypeOptions();
    List<EnumOptionData> interestCalculationPeriodTypeOptions =
        dropdownReadPlatformService.retrieveLoanInterestRateCalculatedInPeriodOptions();
    List<EnumOptionData> repaymentFrequencyTypeOptions =
        dropdownReadPlatformService.retrieveRepaymentFrequencyTypeOptions();
    List<EnumOptionData> interestRateFrequencyTypeOptions =
        dropdownReadPlatformService.retrieveInterestRateFrequencyTypeOptions();

    productData.setCurrencyOptions(currencyOptions);
    productData.setAmortizationTypeOptions(amortizationTypeOptions);
    productData.setInterestTypeOptions(interestTypeOptions);
    productData.setInterestCalculationPeriodTypeOptions(interestCalculationPeriodTypeOptions);
    productData.setRepaymentFrequencyTypeOptions(repaymentFrequencyTypeOptions);
    productData.setInterestRateFrequencyTypeOptions(interestRateFrequencyTypeOptions);
  }