private Optional<Comparator<Account>> buildComparator(final FindAccountRequest request) {
        if (NullSafe.hasItems(request, FindAccountRequest::getSortList)) {
            return Optional.of(CompareUtil.buildCriteriaComparator(FIELD_COMPARATORS, request));
        } else {
            return Optional.empty();
        }
    }
Create a derived field that represents the account state.
stroom-security/stroom-security-identity-db/src/main/java/stroom/security/identity/db/AccountDaoImpl.java