public void WriteXml(XmlWriter writer)
        {
            if (Value == null)
            {
                return;
            }

            writer.WriteRaw(XmlConvert.ToString(RestDatabase.DateTimeToTimestamp(Value)));
        }
        private object ToJson(object value)
        {
            if (value is RestDateTime)
            {
                return(RestDatabase.DateTimeToTimestamp(((RestDateTime)value).Value));
            }

            if (value is Enum)
            {
                return((int)value);
            }

            if (value is IRestObject)
            {
                return(((IRestObject)value).ToJson());
            }

            if (value is IList)
            {
                List <object> list = new List <object>();
                foreach (object item in (IList)value)
                {
                    list.Add(ToJson(item));
                }
                return(list);
            }

            if (value is IDictionary)
            {
                Dictionary <string, object> map = new Dictionary <string, object>();
                foreach (KeyValuePair <string, object> item in (IDictionary)value)
                {
                    map.Add(item.Key, ToJson(item.Value));
                }
                return(map);
            }

            return(value);
        }