private static GracefulExpandoObject FromObjectDeep(object obj, bool ignoreNullValues)
        {
            var geo        = new GracefulExpandoObject();
            var type       = obj.GetType();
            var properties = GetProperties(type);

            foreach (var property in properties)
            {
                if (IsPrimitive(property.PropertyType))
                {
                    var value = property.GetValue(obj);
                    geo.Add(property.Name, value);
                }
                else
                {
                    var value = property.GetValue(obj);
                    if (ignoreNullValues && value == null)
                    {
                        continue;
                    }
                    if (value == null)
                    {
                        geo.Add(property.Name, null);
                    }
                    else
                    {
                        geo.Add(property.Name, FromObjectDeep(value, ignoreNullValues));
                    }
                }
            }

            return(geo);
        }
        private static GracefulExpandoObject FromObjectShallow(object obj, bool ignoreNullValues)
        {
            var geo        = new GracefulExpandoObject();
            var type       = obj.GetType();
            var properties = GetProperties(type);

            foreach (var property in properties)
            {
                var value = property.GetValue(obj);
                if (ignoreNullValues && !IsPrimitive(property.PropertyType) && value == null)
                {
                    continue;
                }
                geo.Add(property.Name, value);
            }

            return(geo);
        }