public PropertyBag Convert(object obj)
{
Type type = obj.GetType();
var document = new PropertyBag(type);
foreach (PropertyInfo propertyInfo in type.GetProperties(PublicInstanceProperties))
{
document.AddPropertyValue(propertyInfo.Name, propertyInfo.GetValue(obj, null));
}
return document;
}