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