class CmsPsuConfirmationOfFundsServiceInternal implements CmsPsuConfirmationOfFundsService {

    @Override
    @Transactional
    public boolean updateConsentStatus(@NotNull String consentId, @NotNull ConsentStatus status, @NotNull String instanceId) {
        Optional<ConsentEntity> consentEntityOptional = getActualConsent(consentId, instanceId);

        if (consentEntityOptional.isEmpty()) {
            log.info("Consent ID: [{}], Instance ID: [{}]. Update of consent status failed, because consent either has finalised status or not found", consentId, instanceId);
            return false;
        }

        ConsentEntity consentEntity = consentEntityOptional.get();
        consentEntity.setConsentStatus(status);
        return true;
    }

}