code: @Programmatic
      public ApplicationUser newLocalUser(
              final String username,
              final Password password,
              final Password passwordRepeat,
              final ApplicationRole initialRole,
              final Boolean enabled,
              final String emailAddress) {
          ApplicationUser user = findByUsername(username);
          if (user == null) {
              user = getApplicationUserFactory().newApplicationUser();
              user.setUsername(username);
              user.setStatus(ApplicationUserStatus.parse(enabled));
              user.setAccountType(AccountType.LOCAL);
          }
          if (initialRole != null) {
              user.addRole(initialRole);
          }
          if (password != null) {
              user.updatePassword(password.getPassword());
          }
          if (emailAddress != null) {
              user.updateEmailAddress(emailAddress);
          }
          container.persistIfNotAlready(user);
          return user;
      }
docs: region > newLocalUser (action)