private tblProduct GetOrCreatePackagingProduct(PackagingProduct packagingProduct, IEmployeeKey employeeKey, DateTime timestamp) { tblPackaging tblPackaging; var product = _oldContextHelper.GetProductFromPackagingId(packagingProduct.Product.ProductCode, out tblPackaging); if (product == null) { product = new tblProduct { ProdID = _oldContextHelper.GetNextProductId(5), Product = packagingProduct.Product.Name, ProdGrpID = 98, PTypeID = 5, PkgID = tblPackaging == null ? (int?)null : tblPackaging.PkgID, TrtmtID = 0, EmployeeID = employeeKey.EmployeeKey_Id, EntryDate = timestamp.ConvertUTCToLocal(), InActive = false }; _oldContext.CreateObjectSet <tblProduct>().AddObject(product); } return(product); }