@Override
  public void removeProductImage(ProductImage productImage) throws ServiceException {

    if (cacheManager.getTreeCache() == null) {
      throw new ServiceException(
          "CmsImageFileManagerInfinispan has a null cacheManager.getTreeCache()");
    }

    try {

      StringBuilder nodePath = new StringBuilder();
      nodePath
          .append(productImage.getProduct().getMerchantStore().getCode())
          .append(Constants.SLASH)
          .append(productImage.getProduct().getSku());

      Node<String, Object> productNode = this.getNode(nodePath.toString());
      productNode.remove(productImage.getProductImage());

    } catch (Exception e) {
      throw new ServiceException(e);
    } finally {

    }
  }
  @Override
  public OutputContentFile getProductImage(ProductImage productImage) throws ServiceException {

    return getProductImage(
        productImage.getProduct().getMerchantStore().getCode(),
        productImage.getProduct().getSku(),
        productImage.getProductImage());
  }
  /**
   * root -productFiles -merchant-id PRODUCT-ID(key) -> CacheAttribute(value) - image 1 - image 2 -
   * image 3
   */
  @Override
  public void addProductImage(ProductImage productImage, ImageContentFile contentImage)
      throws ServiceException {

    if (cacheManager.getTreeCache() == null) {
      throw new ServiceException(
          "CmsImageFileManagerInfinispan has a null cacheManager.getTreeCache()");
    }

    try {

      // node
      StringBuilder nodePath = new StringBuilder();
      nodePath
          .append(productImage.getProduct().getMerchantStore().getCode())
          .append(Constants.SLASH)
          .append(productImage.getProduct().getSku())
          .append(Constants.SLASH);

      if (contentImage.getFileContentType().name().equals(FileContentType.PRODUCT.name())) {
        nodePath.append(SMALL);
      } else if (contentImage
          .getFileContentType()
          .name()
          .equals(FileContentType.PRODUCTLG.name())) {
        nodePath.append(LARGE);
      }

      Node<String, Object> productNode = this.getNode(nodePath.toString());

      InputStream isFile = contentImage.getFile();

      ByteArrayOutputStream output = new ByteArrayOutputStream();
      IOUtils.copy(isFile, output);

      // object for a given product containing all images
      productNode.put(contentImage.getFileName(), output.toByteArray());

    } catch (Exception e) {

      throw new ServiceException(e);
    }
  }