docs: @SuppressWarnings("checkstyle:npathcomplexity")
  	public static Node writeBusNetwork(BusNetwork busNetwork, XMLBuilder builder, XMLResources resources) throws IOException {
  		final Element element = builder.createElement(NODE_BUSNETWORK);
  
  		writeGISElementAttributes(element, busNetwork, builder, resources);
  		final Integer color = busNetwork.getRawColor();
  		if (color != null) {
  			element.setAttribute(ATTR_COLOR, toColor(color));
  		}
  
  		final Element stopsNode = builder.createElement(NODE_BUSSTOPS);
  		for (final BusStop stop : busNetwork.busStops()) {
  			final Node stopNode = writeBusStop(stop, builder, resources);
  			if (stopNode != null) {
  				stopsNode.appendChild(stopNode);
  			}
  		}
  		if (stopsNode.getChildNodes().getLength() > 0) {
  			element.appendChild(stopsNode);
  		}
  
  		final Element hubsNode = builder.createElement(NODE_BUSHUBS);
  		for (final BusHub hub : busNetwork.busHubs()) {
  			final Node hubNode = writeBusHub(hub, builder, resources);
  			if (hubNode != null) {
  				hubsNode.appendChild(hubNode);
  			}
  		}
  		if (hubsNode.getChildNodes().getLength() > 0) {
  			element.appendChild(hubsNode);
  		}
  
  		final Element linesNode = builder.createElement(NODE_BUSLINES);
  		for (final BusLine line : busNetwork.busLines()) {
  			final Node lineNode = writeBusLine(line, builder, resources);
  			if (lineNode != null) {
  				linesNode.appendChild(lineNode);
  			}
  		}
  		if (linesNode.getChildNodes().getLength() > 0) {
  			element.appendChild(linesNode);
  		}
  
  		return element;
  	}