protected ElementNode toElement(ConfigModel config, String ns) {
final ElementNode configE = addElement(null, Element.CONFIG.getLocalName(), ns);
if(config.getModel() != null) {
addAttribute(configE, Attribute.MODEL, config.getModel());
final ElementNode propsE = addElement(configE, Element.PROPS.getLocalName(), ns);
for(Map.Entry<String, String> prop : config.getProperties().entrySet()) {
final ElementNode propE = addElement(propsE, Element.PROP.getLocalName(), ns);
addAttribute(propE, Attribute.NAME, prop.getKey());
addAttribute(propE, Attribute.VALUE, prop.getValue());
final ElementNode configDeps = addElement(configE, Element.CONFIG_DEPS.getLocalName(), ns);
for(Map.Entry<String, ConfigId> dep : config.getConfigDeps().entrySet()) {
final ElementNode configDep = addElement(configDeps, Element.CONFIG_DEP.getLocalName(), ns);
addAttribute(configDep, Attribute.ID.getLocalName(), dep.getKey());
final ConfigId configId = dep.getValue();
layers = addElement(configE, Element.LAYERS.getLocalName(), ns);
addAttribute(layers, Attribute.INHERIT, "false");
layers = addElement(configE, Element.LAYERS.getLocalName(), ns);
final ElementNode layer = addElement(layers, Element.INCLUDE.getLocalName(), ns);
addAttribute(layer, Attribute.NAME, layerDep);
layers = addElement(configE, Element.LAYERS.getLocalName(), ns);
final ElementNode layer = addElement(layers, Element.EXCLUDE.getLocalName(), ns);
addAttribute(layer, Attribute.NAME, layerDep);