public static Dictionary <string, SerializableProperty> GetProperties(ISerializableEntity obj)
        {
            var properties = TypeDescriptor.GetProperties(obj.GetType()).Cast <PropertyDescriptor>();

            Dictionary <string, SerializableProperty> dictionary = new Dictionary <string, SerializableProperty>();

            foreach (var property in properties)
            {
                dictionary.Add(property.Name.ToLowerInvariant(), new SerializableProperty(property, obj));
            }

            return(dictionary);
        }
    public static IDictionary <string, object> ToSerializable(
        this ISerializableEntity obj)
    {
        var result = new Dictionary <string, object>();

        foreach (var property in obj.GetType().GetProperties().ToList())
        {
            var value = property.GetValue(obj, null);

            if (value != null && (value.GetType().IsPrimitive ||
                                  value is decimal || value is string || value is DateTime ||
                                  value is List <object>))
            {
                result.Add(property.Name, value);
            }
        }

        return(result);
    }