public static IDictionary<string, object> ToDictionary(this object o) { return o.GetType().GetProperties() .Select(n => n.Name) .ToDictionary(k => k, k => o.GetType().GetProperty(k).GetValue(o, null)); }