@Indexable(type = IndexableType.DELETE)
  @Override
  public AssetCategory deleteCategory(AssetCategory category, boolean childCategory)
      throws PortalException, SystemException {

    // Categories

    List<AssetCategory> categories =
        assetCategoryPersistence.findByParentCategoryId(category.getCategoryId());

    for (AssetCategory curCategory : categories) {
      deleteCategory(curCategory, true);
    }

    if (!categories.isEmpty() && !childCategory) {
      final long groupId = category.getGroupId();

      TransactionCommitCallbackRegistryUtil.registerCallback(
          new Callable<Void>() {

            @Override
            public Void call() throws Exception {
              assetCategoryLocalService.rebuildTree(groupId, true);

              return null;
            }
          });
    }

    // Category

    assetCategoryPersistence.remove(category);

    // Resources

    resourceLocalService.deleteResource(
        category.getCompanyId(),
        AssetCategory.class.getName(),
        ResourceConstants.SCOPE_INDIVIDUAL,
        category.getCategoryId());

    // Entries

    List<AssetEntry> entries = assetTagPersistence.getAssetEntries(category.getCategoryId());

    // Properties

    assetCategoryPropertyLocalService.deleteCategoryProperties(category.getCategoryId());

    // Indexer

    assetEntryLocalService.reindex(entries);

    return category;
  }
  public void addCategoryResources(
      AssetCategory category, String[] communityPermissions, String[] guestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addModelResources(
        category.getCompanyId(),
        category.getGroupId(),
        category.getUserId(),
        AssetCategory.class.getName(),
        category.getCategoryId(),
        communityPermissions,
        guestPermissions);
  }
  public void addCategoryResources(
      AssetCategory category, boolean addCommunityPermissions, boolean addGuestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addResources(
        category.getCompanyId(),
        category.getGroupId(),
        category.getUserId(),
        AssetCategory.class.getName(),
        category.getCategoryId(),
        false,
        addCommunityPermissions,
        addGuestPermissions);
  }