/// <summary>
        /// Define whether tax definition applies and return calculated amount.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="taxAmount"></param>
        /// <returns></returns>
        protected bool AppliesTaxItem(decimal grossAmount, TaxDefinitionItem item, out decimal taxAmount)
        {
            if (item == null)
            {
                throw new ArgumentException("Undefined tax item");
            }

            taxAmount = 0m;
            if (grossAmount >= item.FromAmountIncluding && grossAmount < item.UpToAmount)
            {
                if (item.UpToAmount >= TaxDefinitionItem.MaxUpToAmount)
                {
                    taxAmount = item.BaseTaxAmount + (grossAmount - item.FromAmountIncluding) * item.PercentAboveFrom;
                }
                else
                {
                    taxAmount = item.BaseTaxAmount;
                    if (grossAmount >= item.UpToAmount)
                    {
                        taxAmount += (item.UpToAmount - item.FromAmountIncluding) * item.PercentAboveFrom;
                    }
                    else
                    {
                        taxAmount += (grossAmount - item.FromAmountIncluding) * item.PercentAboveFrom;
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected void AddExplanation(Salary salary, TaxDefinitionItem item, decimal amount)
        {
            if (salary.TaxExplanation == null)
            {
                salary.TaxExplanation = new Dictionary <TaxDefinitionItem, decimal>();
            }

            salary.TaxExplanation.Add(item, amount);
            salary.TaxAmount += amount;
        }