protected function getCategoryLevel($parentCategoryId, \Category $parentCategory=null, \DmsLoaderParams $params)
  {
    $arrCategories = array();
    $objCategory = $this->Database->prepare("SELECT * FROM tl_dms_categories WHERE pid = ? ORDER BY sorting")
                    ->execute($parentCategoryId);
    
    $category = null;
    while ($objCategory->next())
    {
      $category = $this->buildCategory($objCategory);
      $category->parentCategory = $parentCategory;
      $category->subCategories = $this->getCategoryLevel($category->id, $category, $params);
      if ($params->loadAccessRights)
      {
        $category->accessRights = $this->getAccessRights($category, $params);
      }
      if ($params->loadDocuments)
      {
        $category->documents = $this->getDocuments($category, $params);
      }
      $arrCategories[$category->id] = $category;
    }

    return $arrCategories;
  }