itemsRepository.delete(deleteItems);
/* Updating/Inserting Purchase Order Items */
List<PurchaseOrderItems> toBeSavedItems = new ArrayList<PurchaseOrderItems>();
for (PurchaseOrderItems item : items) {
PurchaseOrderItems existingItem = existingItemsMap.get(item
.getProduct().getProductName());
Product product = productRepository.findByProductName(item
.getProduct().getProductName());
PurchaseOrder order = poRepository.findByOrderId(uiBean
.getOrderId());
if (existingItem != null) {
existingItem.setQuantity(item.getQuantity());
existingItem.setUnitPrice(item.getUnitPrice());
existingItem.setDiscount(item.getDiscount());
toBeSavedItems.add(existingItem);
item = existingItem;
} else {
item.setProduct(product);
item.setPo(order);