class MavenComponentMaintenanceFacet extends DefaultComponentMaintenanceImpl {

  @TransactionalDeleteBlob
  @Override
  protected Set<String> deleteAssetTx(final EntityId assetId, final boolean deleteBlob) {
    StorageTx tx = UnitOfWork.currentTx();
    Asset asset = tx.findAsset(assetId);
    if (asset == null) {
      return Collections.emptySet();
    }

    Set<String> deletedAssets = new HashSet<>(super.deleteAssetTx(assetId, deleteBlob));

    final EntityId componentId = asset.componentId();
    if (componentId != null) {
      Component component = tx.findComponent(componentId);
      if (component != null && !tx.browseAssets(component).iterator().hasNext()) {
        deletedAssets.addAll(deleteComponentTx(componentId, deleteBlob).getAssets());
      }
    }

    return deletedAssets;
  }

}