for (OrganisationCurrency priorCurrency : this.organisationCurrencyRepository.findAll()) {
if (!allowedCurrencyCodes.contains(priorCurrency.getCode())) {
// Check if it's safe to remove this currency.
if (!loanProductService.retrieveAllLoanProductsForCurrency(priorCurrency.getCode()).isEmpty()
|| !savingsProductService.retrieveAllForCurrency(priorCurrency.getCode()).isEmpty()
|| !chargeService.retrieveAllChargesForCurrency(priorCurrency.getCode()).isEmpty()) { throw new CurrencyInUseException(
priorCurrency.getCode()); }
}
}
changes.put("currencies", allowedCurrencyCodes.toArray(new String[allowedCurrencyCodes.size()]));