private static void AddObjectPropertiesToMessageData(IDictionary <string, object?> data, object value) { PropertyDescriptorCollection ItemProperties = TypeDescriptor.GetProperties(value); foreach (PropertyDescriptor?ItemProperty in ItemProperties) { if (ItemProperty == null) { continue; } data[ItemProperty.Name] = ItemProperty.GetValue(value); } }