code: protected static Map<String, List<Object>> convertPrincipalAttributesToPersonAttributes(final Map<String, ?> attributes) {
          val convertedAttributes = new TreeMap<String, List<Object>>(String.CASE_INSENSITIVE_ORDER);
          val principalAttributes = new LinkedHashMap<>(attributes);
          principalAttributes.forEach((key, values) -> {
              if (values instanceof Collection) {
                  val uniqueValues = new LinkedHashSet<Object>(Collection.class.cast(values));
                  val listedValues = new ArrayList<Object>(uniqueValues);
                  convertedAttributes.put(key, listedValues);
              } else {
                  convertedAttributes.put(key, CollectionUtils.wrap(values));
              }
          });
          return convertedAttributes;
      }
docs: *
  Convert principal attributes to person attributes.
  @param attributes the attributes
  @return person attributes