public static function flattenCategories(Array $arrCategories)
  {
    $arrFlattend = array();
    
    foreach ($arrCategories as $category)
    {
      $arrFlattend[] = $category;
      if ($category->hasSubCategories())
      {
        $arrFlattend = array_merge($arrFlattend, \DmsLoader::flattenCategories($category->subCategories));
      }
    }
    
    return $arrFlattend;
  }