@Override
  public List<AssetVocabulary> deleteVocabularies(
      long[] vocabularyIds, ServiceContext serviceContext) throws PortalException {

    List<AssetVocabulary> failedVocabularies = new ArrayList<>();

    for (long vocabularyId : vocabularyIds) {
      try {
        AssetVocabularyPermission.check(getPermissionChecker(), vocabularyId, ActionKeys.DELETE);

        assetVocabularyLocalService.deleteVocabulary(vocabularyId);
      } catch (PortalException pe) {
        if (serviceContext == null) {
          return null;
        }

        if (serviceContext.isFailOnPortalException()) {
          throw pe;
        }

        AssetVocabulary vocabulary = assetVocabularyPersistence.fetchByPrimaryKey(vocabularyId);

        if (vocabulary == null) {
          vocabulary = assetVocabularyPersistence.create(vocabularyId);
        }

        failedVocabularies.add(vocabulary);
      }
    }

    return failedVocabularies;
  }
  @Override
  public AssetVocabulary getVocabulary(long vocabularyId) throws PortalException {

    AssetVocabularyPermission.check(getPermissionChecker(), vocabularyId, ActionKeys.VIEW);

    return assetVocabularyLocalService.getVocabulary(vocabularyId);
  }
  @Override
  public AssetVocabulary updateVocabulary(
      long vocabularyId,
      String title,
      Map<Locale, String> titleMap,
      Map<Locale, String> descriptionMap,
      String settings,
      ServiceContext serviceContext)
      throws PortalException {

    AssetVocabularyPermission.check(getPermissionChecker(), vocabularyId, ActionKeys.UPDATE);

    return assetVocabularyLocalService.updateVocabulary(
        vocabularyId, title, titleMap, descriptionMap, settings, serviceContext);
  }
  @Override
  public void deleteVocabulary(long vocabularyId) throws PortalException {
    AssetVocabularyPermission.check(getPermissionChecker(), vocabularyId, ActionKeys.DELETE);

    assetVocabularyLocalService.deleteVocabulary(vocabularyId);
  }