code: public static List<Entry> permissionStructureFromPermissionData(Collection<PermissionData> data, Dn baseDn) {
  
          List<Entry> permissions = new LinkedList<Entry>();
          List<Entry> properties = new LinkedList<Entry>();
          List<Entry> propertyValues = new LinkedList<Entry>();
          List<Entry> result = new LinkedList<Entry>();
  
          for (PermissionData p : data) {
              String permissionType = p.getType();
              Entry permissionEntry = javaObject(permissionType, null, baseDn);
              TimebasedOrderFilter.addId(permissionEntry, true);
              permissions.add(permissionEntry);
  
              for (EntryValue entryValue : p.getAttributes().values()) {
                  String propertyKey = entryValue.getKey();
                  Entry propertyEntry = namedObject(propertyKey, permissionEntry.getDn());
                  properties.add(propertyEntry);
  
                  for (EntryElement entryElement : entryValue.getValue()) {
                      String type = entryElement.getType();
                      String value = entryElement.getValue();
                      Entry propertyValueEntry = javaObject(type, value, propertyEntry.getDn());
                      TimebasedOrderFilter.addId(propertyValueEntry, true);
                      propertyValues.add(propertyValueEntry);
                  }
              }
          }
          result.addAll(permissions);
          result.addAll(properties);
          result.addAll(propertyValues);
          return result;
      }
docs: Returns a list of entries representing a list of {@link PermissionData}. The list should not be reordered since
  its order follows the tree structure of the DIT. It can be inserted into the DIT right away.