/// <summary>
            /// Writes the JSON representation of the object.
            /// </summary>
            /// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
            /// <param name="value">The value.</param>
            /// <param name="serializer">The calling serializer.</param>
            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
            {
                Type valueType = value.GetType();

                // We don't want to use the type name of the enum itself; instead we marshal
                // it as a decimal number inside of a string
                if (valueType.GetTypeInfo().IsEnum)
                {
                    value     = ((Enum)value).ToString("D");
                    valueType = typeof(String);
                }

                PropertyValidation.ValidatePropertyValue(WebApiResources.SerializingPhrase(), value);

                //write out as an object with type information
                writer.WriteStartObject();
                writer.WritePropertyName(TypePropertyName);

                // Check that the Type we're claiming is safely deserializable
                String typeName = valueType.FullName;

                if (!PropertyValidation.IsValidTypeString(typeName))
                {
                    throw new PropertyTypeNotSupportedException(TypePropertyName, valueType);
                }

                writer.WriteValue(typeName);
                writer.WritePropertyName(ValuePropertyName);
                writer.WriteValue(value);
                writer.WriteEndObject();
            }
        void ICollection <KeyValuePair <String, Object> > .Add(KeyValuePair <String, Object> keyValuePair)
        {
            if (this.ValidateNewValues)
            {
                PropertyValidation.ValidatePropertyName(keyValuePair.Key);
                PropertyValidation.ValidatePropertyValue(keyValuePair.Key, keyValuePair.Value);
            }

            ((ICollection <KeyValuePair <String, Object> >)m_innerDictionary).Add(keyValuePair);
        }
        /// <summary>
        /// Implements IDictionary&lt;String, Object&gt;.Add
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void Add(String key, Object value)
        {
            if (this.ValidateNewValues)
            {
                PropertyValidation.ValidatePropertyName(key);
                PropertyValidation.ValidatePropertyValue(key, value);
            }

            m_innerDictionary.Add(key, value);
        }
        /// <summary>
        /// Implements IDictionary&lt;String, Object&gt;.Item
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public Object this[String key]
        {
            get
            {
                return(m_innerDictionary[key]);
            }
            set
            {
                if (this.ValidateNewValues)
                {
                    PropertyValidation.ValidatePropertyName(key);
                    PropertyValidation.ValidatePropertyValue(key, value);
                }

                m_innerDictionary[key] = value;
            }
        }