// ##TODO: Should be in repo... REFACTOR!!!
        // ##BUG: The inspection record not picking up all the records from this entity...
        private void AssignFactoryInspectionIdToInspection(InspectionWarehouse inspectionWarehouse)
        {
            Inspection inspection = new Inspection();

            var currentInspection = db.Inspections.Where
                (
                    i => i.ProductId == inspectionWarehouse.ProductId &&
                    i.PurchaseOrder == inspectionWarehouse.PurchaseOrder &&
                    i.WarehouseInspection.ReceivingInspectionDT == inspectionWarehouse.ReceivingInspectionDT
                );

            if (currentInspection != null && currentInspection.Count() > 0)
            {
                inspection.WarehouseInspectionId = inspectionWarehouse.WarehouseInspectionId;
                inspection.WarehouseInspection = inspectionWarehouse;
                inspection.WarehouseInspection.RejectedCount = inspectionWarehouse.RejectedCount;
                inspection.ModifiedDT = DateTime.Now.Date;

                inspection.IsWarehouseIncomming = true;
            }
            else
            {
                inspection.FactoryInspectionId = inspectionWarehouse.WarehouseInspectionId;
                inspection.ProductId = inspectionWarehouse.ProductId;
                inspection.PurchaseOrder = inspectionWarehouse.PurchaseOrder;
                inspection.ProductEvaluationDT = inspectionWarehouse.ReceivingInspectionDT;
                inspection.WarehouseInspection = inspectionWarehouse;
                inspection.WarehouseInspection.RejectedCount = inspectionWarehouse.RejectedCount;
                inspection.IsPreship = true;

                inspection.CreatedDT = DateTime.Now.Date;
                inspection.ModifiedDT = DateTime.Now.Date;
            }

            db.Inspections.Add(inspection);
            db.SaveChanges();
        }
        // ##TODO: Should be in repo... REFACTOR!!!
        // ##BUG: The inspection record not picking up all the records from this entity...
        private void AssignFactoryInspectionIdToInspection(InspectionFactory inspectionFactory)
        {
            Inspection inspection = new Inspection();

            var currentInspection = db.Inspections.Where
                (
                    i => i.ProductId == inspectionFactory.ProductId &&
                    i.PurchaseOrder == inspectionFactory.PurchaseOrder &&
                    i.FactoryInspection.InspectionDT == inspectionFactory.InspectionDT
                );

            if(currentInspection != null && currentInspection.Count() > 0 )
            {
                inspection.FactoryInspectionId = inspectionFactory.FactoryInspectionId;
                inspection.FactoryInspection = inspectionFactory;
                inspection.FactoryDefectiveCount = inspectionFactory.ReplacedRejectedCount;
                inspection.IsPreship = true;
                inspection.ModifiedDT = DateTime.Now.Date;
            }
            else
            {
                inspection.FactoryInspectionId = inspectionFactory.FactoryInspectionId;
                inspection.ProductId = inspectionFactory.ProductId;
                inspection.PurchaseOrder = inspectionFactory.PurchaseOrder;
                inspection.ProductEvaluationDT = inspectionFactory.InspectionDT;
                inspection.FactoryInspection = inspectionFactory;
                inspection.FactoryDefectiveCount = inspectionFactory.ReplacedRejectedCount;
                inspection.IsPreship = true;

                inspection.CreatedDT = DateTime.Now.Date;
                inspection.ModifiedDT = DateTime.Now.Date;
            }

            db.Inspections.Add(inspection);
            db.SaveChanges();
        }