private JToken CreateJObject(JsonReader reader)
        {
            ValidationUtils.ArgumentNotNull(reader, "reader");

            // this is needed because we've already read inside the object, looking for metadata properties
            using (JTokenWriter writer = new JTokenWriter())
            {
                writer.WriteStartObject();

                do
                {
                    if (reader.TokenType == JsonToken.PropertyName)
                    {
                        string propertyName = (string)reader.Value;
                        do
                        {
                            if (!reader.Read())
                                break;
                        } while (reader.TokenType == JsonToken.Comment);

                        if (CheckPropertyName(reader, propertyName))
                            continue;

                        writer.WritePropertyName(propertyName);
                        writer.WriteToken(reader, true, true);
                    }
                    else if (reader.TokenType == JsonToken.Comment)
                    {
                        // eat
                    }
                    else
                    {
                        writer.WriteEndObject();
                        return writer.Token;
                    }
                } while (reader.Read());

                throw JsonSerializationException.Create(reader, "Unexpected end when deserializing object.");
            }
        }
        private JToken CreateJObject(JsonReader reader)
        {
            ValidationUtils.ArgumentNotNull(reader, "reader");

            // this is needed because we've already read inside the object, looking for special properties
            JToken token;
            using (JTokenWriter writer = new JTokenWriter())
            {
                writer.WriteStartObject();

                if (reader.TokenType == JsonToken.PropertyName)
                    writer.WriteToken(reader, reader.Depth - 1, true, true);
                else
                    writer.WriteEndObject();

                token = writer.Token;
            }

            return token;
        }