public function loadCategories(\DmsLoaderParams $params)
  {
    $rootCategory = null;
    // if another root category is selected
    if ($params->loadRootCategory && $params->rootCategoryId > 0)
    {
      $rootCategory = $this->loadCategory($params->rootCategoryId, $params);
      
      $arrCategories = $this->getCategoryLevel($params->rootCategoryId, $rootCategory, $params);
      
      if ($params->includeRootCategory)
      {
        $rootCategory->subCategories = $arrCategories;
        $arrCategories = array();
        $arrCategories[] = $rootCategory;
      }
      
      return $arrCategories;
    }
    return $this->getCategoryLevel($params->rootCategoryId, null, $params);
  }