public static void collectProperties(final SapphirePart part, final Set<Property> result) {
    if (part.visible()) {
      if (part instanceof ContainerPart) {
        for (FormComponentPart child : ((ContainerPart<?>) part).children().visible()) {
          collectProperties(child, result);
        }
      } else if (part instanceof WithPart) {
        final WithPart w = ((WithPart) part);
        result.add(w.property());
      } else if (part instanceof PropertyEditorPart) {
        final PropertyEditorPart editor = (PropertyEditorPart) part;

        if (!editor.isReadOnly()) {
          result.add(editor.property());
        }

        for (SapphirePart related : editor.getRelatedContent()) {
          collectProperties(related, result);
        }
      }
    }
  }