public static Models.Loan MapFrom(this External.LoanObject loanObject, Models.Loan loan = null)
        {
            bool changed = false;

            var _primaryborrower = PersonExtension.MapFrom(loanObject, FieldList.PrimaryBorrower, loan?.PrimaryBorrower);

            changed = changed || (_primaryborrower != null);

            var _w2 = AttachmentExtension.MapFrom(loanObject, FieldList.W2, loan?.W2);

            changed = changed || (_w2 != null);

            changed = changed || loanObject.ContainsValues(FieldList.LoanAmount);

            if (changed)
            {
                if (loan == null)
                {
                    loan = new Loan();
                }

                loan.PrimaryBorrower = _primaryborrower;
                loan.W2 = _w2;
                MappingUtil.SetValue(loanObject, FieldList.LoanAmount, (val) => loan.LoanAmount = val, loan.LoanAmount);
            }

            return(loan);
        }
        public static Models.Attachment MapFrom(this External.LoanObject loanObject, AttachmentFieldList fields, Models.Attachment attachment = null)
        {
            bool changed = false;

            changed = changed || loanObject.ContainsValues(fields.Name, fields.DocumentId);


            if (changed)
            {
                if (attachment == null)
                {
                    attachment = new Attachment();
                }

                MappingUtil.SetValue(loanObject, fields.Name, (val) => attachment.Name             = val, attachment.Name);
                MappingUtil.SetValue(loanObject, fields.DocumentId, (val) => attachment.DocumentId = val, attachment.DocumentId);
            }

            return(attachment);
        }