private static void AddRate(int productId, double productRate, RxRates rates, RasterGridPrescription prescription, UnitOfMeasure uom)
        {
            RxProductLookup rxProductLookup;
            if (prescription.RxProductLookups.Any(x => x.ProductId == productId))
                rxProductLookup = prescription.RxProductLookups.Single(x => x.ProductId == productId);
            else
            {
                rxProductLookup = new RxProductLookup
                {
                    ProductId = productId,
                    UnitOfMeasure = uom

                };
                prescription.RxProductLookups.Add(rxProductLookup);
            }

            var rxRate = new RxRate
            {
                Rate = productRate,
                RxProductLookupId = rxProductLookup.Id.ReferenceId,
            };

            rates.RxRate.Add(rxRate);
        }
        private void LoadRateUnits(TreatmentZone treatmentZone, RasterGridPrescription prescription)
        {
            if(prescription.RxProductLookups == null)
                prescription.RxProductLookups = new List<RxProductLookup>();

            var rxRates = new List<RxRate>();
            foreach (var dataVariable in treatmentZone.Variables)
            {
                var product = _taskDocument.Products.FindById(dataVariable.ProductId) ?? _taskDocument.ProductMixes.FindById(dataVariable.ProductId);
                var rxProductLookup = new RxProductLookup
                {
                    ProductId = product == null ? 0 : product.Id.FindIntIsoId(),
                    UnitOfMeasure = dataVariable.IsoUnit.ToAdaptUnit(),
                };
                prescription.RxProductLookups.Add(rxProductLookup);
                var rxRate = new RxRate
                {
                    Rate = dataVariable.Value,
                    RxProductLookupId = rxProductLookup.Id.ReferenceId,
                };
                rxRates.Add(rxRate);
            }
            prescription.Rates = new List<RxRates>{ new RxRates{ RxRate = rxRates }};
        }