update product price from purchase order detail  List<PurchaseOrderDetail> pods = ContextFactory.GetContextPerRequest().PurchaseOrderDetails.Where(pod => pod.PurchaseOrderId == PurchaseOrderId).ToList();

            foreach (PurchaseOrderDetail pod in pods)
            {
                pod.Product.UnitPrice = (decimal)pod.Product.GetAveragePriceLastDays(14);
            }
            ContextFactory.GetContextPerRequest().SaveChanges();