private function build_section_tree($sections) {
    $level_tree = array();

    foreach ($sections as $level => $section) {
      // array_filter removes the last, empty value
      // from the level array that is created by the explode function
      $level_depth_arr = array_filter(explode('.', $level));

      $level_depth = count($level_depth_arr);

      // Get the parent level
      array_pop($level_depth_arr);
      $level_parent = $level_depth > 1 ? implode('.', $level_depth_arr) . '.' : $level;

      // Add the current section to the level tree
      $level_tree[$level_depth][$level_parent][$level] = $section;
    }

    // Run over all main sections in $level_tree[1]
    foreach ($level_tree[1] as $section_level => $section) {
      // Add corresponding sub levels to the main level
      $section[$section_level]['sub'] = $this->build_section_sub_tree($level_tree, 2, $section_level);

      $this->sections += $section;
    }
  }