/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(FormOfPayment compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [FormOfPayment] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual FormOfPayment Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, FormOfPayment copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((FormOfPayment)copiedObjects[this]);
            }
            copy = copy ?? new FormOfPayment();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.Description = this.Description;
            copy.Key         = this.Key;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.voucher != null)
            {
                if (!copiedObjects.Contains(this.voucher))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Voucher = this.Voucher;
                    }
                    else if (asNew)
                    {
                        copy.Voucher = this.Voucher.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.voucher = this.voucher.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Voucher = (Voucher)copiedObjects[this.Voucher];
                    }
                    else
                    {
                        copy.voucher = (Voucher)copiedObjects[this.Voucher];
                    }
                }
            }
            if (deep && this.guarantee != null)
            {
                if (!copiedObjects.Contains(this.guarantee))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Guarantee = this.Guarantee;
                    }
                    else if (asNew)
                    {
                        copy.Guarantee = this.Guarantee.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.guarantee = this.guarantee.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Guarantee = (Guarantee)copiedObjects[this.Guarantee];
                    }
                    else
                    {
                        copy.guarantee = (Guarantee)copiedObjects[this.Guarantee];
                    }
                }
            }
            if (deep && this.cash != null)
            {
                if (!copiedObjects.Contains(this.cash))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Cash = this.Cash;
                    }
                    else if (asNew)
                    {
                        copy.Cash = this.Cash.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.cash = this.cash.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Cash = (Cash)copiedObjects[this.Cash];
                    }
                    else
                    {
                        copy.cash = (Cash)copiedObjects[this.Cash];
                    }
                }
            }
            if (deep && this.creditCard != null)
            {
                if (!copiedObjects.Contains(this.creditCard))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.CreditCard = this.CreditCard;
                    }
                    else if (asNew)
                    {
                        copy.CreditCard = this.CreditCard.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.creditCard = this.creditCard.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.CreditCard = (CreditCard)copiedObjects[this.CreditCard];
                    }
                    else
                    {
                        copy.creditCard = (CreditCard)copiedObjects[this.CreditCard];
                    }
                }
            }
            if (deep && this.enettVan != null)
            {
                if (!copiedObjects.Contains(this.enettVan))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.EnettVan = this.EnettVan;
                    }
                    else if (asNew)
                    {
                        copy.EnettVan = this.EnettVan.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.enettVan = this.enettVan.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.EnettVan = (EnettVan)copiedObjects[this.EnettVan];
                    }
                    else
                    {
                        copy.enettVan = (EnettVan)copiedObjects[this.EnettVan];
                    }
                }
            }
            if (deep && this.payment != null)
            {
                if (!copiedObjects.Contains(this.payment))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.Payment = this.Payment;
                    }
                    else if (asNew)
                    {
                        copy.Payment = this.Payment.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.payment = this.payment.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.Payment = (Payment)copiedObjects[this.Payment];
                    }
                    else
                    {
                        copy.payment = (Payment)copiedObjects[this.Payment];
                    }
                }
            }
            return(copy);
        }