@Override
 public Product saveProduct(Product productVO) throws ProductExistsException {
   Product product = null;
   try {
     // check if the product is already present or not
     try {
       product = productDao.getProductByProductCode(productVO.getCode());
     } catch (ProductCodeNotExistsException cnnee) {
       log.debug("Product Does not exist with name : " + productVO.getCode());
     }
     if (product != null) {
       // product is present, update it
       product.setDescription(productVO.getDescription());
       product.setPrice(productVO.getPrice());
       product.setQuantity(productVO.getQuantity());
     } else {
       // product does not present save it
       product = new Product();
       product.setCode(productVO.getCode());
       product.setDescription(productVO.getDescription());
       product.setPrice(productVO.getPrice());
       product.setQuantity(productVO.getQuantity());
     }
     return productDao.saveProduct(productVO);
   } catch (final Exception e) {
     e.printStackTrace();
     log.warn(e.getMessage());
     throw new ProductExistsException("Product '" + productVO.getCode() + "' already exists!");
   }
 }