code: private String getRealmNameOrFirstBest(Root root) {
          String value = null;
          value = getRealmName(root);
          if (value == null) {
              try {
                  value = getRealmName();
              } catch (Exception e) {
                  // leave realm at null
              }
          }
          return value;
      }
docs: First try to get the default or primary realm defined.
  If not found, then use the realm name from one of the
  registries.
  Added for populating audit records.
  
  @param root
  @return