@Override
    public ConsentDecision storeConsentDecision(final ConsentDecision decision) {
        val account = ObjectUtils.defaultIfNull(
            this.entityManager.find(JpaConsentDecision.class, decision.getId()), new JpaConsentDecision());
        account.setAttributes(decision.getAttributes());
        account.setCreatedDate(decision.getCreatedDate());
        account.setOptions(decision.getOptions());
        account.setPrincipal(decision.getPrincipal());
        account.setReminder(decision.getReminder());
        account.setReminderTimeUnit(decision.getReminderTimeUnit());
        account.setService(decision.getService());

        val isNew = account.getId() < 0;
        val mergedDecision = this.entityManager.merge(account);
        if (!isNew) {
            this.entityManager.persist(mergedDecision);
        }
        return mergedDecision;
    }
This is {@link JpaConsentRepository}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-consent-jdbc/src/main/java/org/apereo/cas/consent/JpaConsentRepository.java