private function getTaxonomyChildren(array $parent, $hyphens = 0) {
    $children = [];
    $selected = [];

    foreach ($parent['children'] as $tid => $child) {
      $children[$tid] = str_repeat('-', $hyphens) . $child['label'];
      if ($child['selected']) {
        $selected[] = $tid;
      }
      if (!empty($child['children'])) {
        $result = $this->getTaxonomyChildren($child, $hyphens + 1);
        $children += $result['children'];
        $selected += $result['selected'];
      }
    }

    return [
      'children' => $children,
      'selected' => $selected,
    ];
  }