class AccountServiceInternal implements AccountService {

    @Override
    @Transactional
    public boolean saveNumberOfTransactions(String consentId, String resourceId, int numberOfTransactions) {

        Optional<ConsentEntity> optionalConsent = consentJpaRepository.findByExternalId(consentId);

        if (optionalConsent.isPresent()) {

            AisConsentTransaction aisConsentTransaction = new AisConsentTransaction();
            aisConsentTransaction.setConsentId(optionalConsent.get());
            aisConsentTransaction.setResourceId(resourceId);
            aisConsentTransaction.setNumberOfTransactions(numberOfTransactions);

            aisConsentTransactionRepository.save(aisConsentTransaction);
            return true;

        } else {
            log.info("Consent ID: [{}]. Save number of transactions failed, because consent not found", consentId);
            return false;
        }

    }

}