 <p>From your stack trace there is a <code>System.InvalidCastException</code></p> <p>It means value of some attribute has incorrect type. Since you are changing only 'tax' attribute, then its type is incorrect. Most probably "tax" is a Money field, so I guess you should assign variable of type <code>decimal</code> to it, not <code>double</code>. Try something like this:</p> <pre><code>decimal Tax = (decimal)((QuoteProduct.BaseAmount - QuoteProduct.ManualDiscountAmount.GetValueOrDefault() - QuoteProduct.VolumeDiscountAmount.GetValueOrDefault()) / 20); </code></pre>