private static void writeRules(@NotNull Element element, @NotNull State state) {
    for (DependencyRule rule : state.rules) {
      Element ruleElement = writeRule(rule);
      if (ruleElement != null) {
        element.addContent(ruleElement);
      }
    }
  }
private static void writeRules(@NotNull Element element, @NotNull State state)