public static object GetAttribute(this ReportDef def, ReportAttributeDef attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentNullException("attribute");
            }

            return(CheckSourceAttribute(def, attribute.SourceId, attribute.AttributeId));
        }
        public static ReportAttributeColumnDef AddColumn(this ReportDef def, Guid sourceId, Guid attrDefId, string caption = null)
        {
            Check(def);
            var attr = CheckSourceAttribute(def, sourceId, attrDefId);

            var attrDef = new ReportAttributeDef {
                SourceId = sourceId, AttributeId = attrDefId
            };
            var s = !String.IsNullOrEmpty(caption)
                ? caption
                : attr is AttrDef
                    ? ((AttrDef)attr).Caption ?? ((AttrDef)attr).Name
                    : ((ReportSourceSystemAttributeDef)attr).Caption;
            var columnDef = new ReportAttributeColumnDef
            {
                Attribute = attrDef,
                Caption   = s,
                Visible   = true,
                Id        = Guid.NewGuid()
            };

            def.Columns.Add(columnDef);
            return(columnDef);
        }