Using the config array to determine the needed nesting levels, building the config tree based on that