public static void MapTo(this Models.Attachment attachment, External.LoanObject loanObject, AttachmentFieldList fields)
 {
     loanObject.MapValue(fields.Name, attachment.Name);
     loanObject.MapValue(fields.DocumentId, attachment.DocumentId);
 }
        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);
        }