@Override
    public void update(final String username, final Collection<CredentialRegistration> givenRecords) {
        val records = givenRecords.stream()
            .map(record -> {
                if (record.getRegistrationTime() == null) {
                    return record.withRegistrationTime(Instant.now(Clock.systemUTC()));
                }
                return record;
            })
            .collect(Collectors.toList());
        val jsonRecords = FunctionUtils.doUnchecked(() -> getCipherExecutor().encode(WebAuthnUtils.getObjectMapper().writeValueAsString(records)));
        transactionTemplate.executeWithoutResult(status -> {
            val count = entityManager.createQuery(UPDATE_QUERY.concat("SET r.records=:records WHERE r.username = :username"))
                .setParameter("username", username.trim().toLowerCase(Locale.ENGLISH))
                .setParameter("records", jsonRecords)
                .executeUpdate();

            if (count == 0) {
                val record = JpaWebAuthnCredentialRegistration.builder()
                    .username(username.trim().toLowerCase(Locale.ENGLISH))
                    .records(jsonRecords)
                    .build();
                entityManager.merge(record);
            }
        });
    }
This is {@link JpaWebAuthnCredentialRepository}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-webauthn-jpa/src/main/java/org/apereo/cas/webauthn/JpaWebAuthnCredentialRepository.java