code: @Programmatic
      public ApplicationUser findOrCreateUserByUsername(
              final String username) {
          // slightly unusual to cache a function that modifies state, but safe because this is idempotent
          return queryResultsCache.execute(new Callable<ApplicationUser>() {
              @Override
              public ApplicationUser call() throws Exception {
                  final ApplicationUser applicationUser = findByUsername(username);
                  if (applicationUser != null) {
                      return applicationUser;
                  }
                  return newDelegateUser(username, null, null);
              }
          }, ApplicationUserRepository.class, "findOrCreateUserByUsername", username);
      }
docs: Uses the {@link QueryResultsCache} in order to support
  multiple lookups from <code>org.isisaddons.module.security.app.user.UserPermissionViewModel</code>.
  <p>
  <p>
  If the user does not exist, it will be automatically created.
  </p>