private void insertOrUpdateStroomUserArchiveRecord(final DSLContext context,
                                                       final String userUuid) {
        Objects.requireNonNull(userUuid);

        try {
            final int changeCount = context.insertInto(STROOM_USER_ARCHIVE,
                            STROOM_USER_ARCHIVE.UUID,
                            STROOM_USER_ARCHIVE.NAME,
                            STROOM_USER_ARCHIVE.DISPLAY_NAME,
                            STROOM_USER_ARCHIVE.FULL_NAME,
                            STROOM_USER_ARCHIVE.IS_GROUP)
                    .select(context.select(
                                    STROOM_USER.UUID,
                                    STROOM_USER.NAME,
                                    STROOM_USER.DISPLAY_NAME,
                                    STROOM_USER.FULL_NAME,
                                    STROOM_USER.IS_GROUP)
                            .from(STROOM_USER)
                            .where(STROOM_USER.UUID.eq(userUuid)))
                    .onDuplicateKeyUpdate()
                    .set(STROOM_USER_ARCHIVE.NAME, STROOM_USER.NAME)
                    .set(STROOM_USER_ARCHIVE.DISPLAY_NAME, STROOM_USER.DISPLAY_NAME)
                    .set(STROOM_USER_ARCHIVE.FULL_NAME, STROOM_USER.FULL_NAME)
                    .set(STROOM_USER_ARCHIVE.IS_GROUP, STROOM_USER.IS_GROUP)
                    .execute();

            LOGGER.debug("insertOrUpdateStroomUserArchiveRecord - changeCount: {} for userUuid: {}",
                    changeCount, userUuid);
        } catch (DataAccessException e) {
            throw new RuntimeException(LogUtil.message("Error upserting archive record for userUuid {}", userUuid), e);
        }
    }
IMPORTANT - This must be called after any insert/update to STROOM_USER (and
as part of the same txn) to ensure STROOM_USER_ARCHIVE is up-to-date.
NOT to be called after a delete statement as we want to preserve the details
of deleted users.
stroom-security/stroom-security-impl-db/src/main/java/stroom/security/impl/db/UserDaoImpl.java