/// <summary>
        /// Initialize bag.
        /// </summary>
        private void InitializeBag(ObjectSchema bagSchema)
        {
            this.propertyValue = new Dictionary <PropertyDefinition, ObjectChangeTracking>();
            if (bagSchema != null)
            {
                foreach (string key in bagSchema.Keys)
                {
                    PropertyDefinition def = bagSchema[key];
                    if (def.IsList)
                    {
                        this.InitializeCollectionProperty(
                            def,
                            null);
                    }
                    else
                    {
                        this.propertyValue[def] = new ObjectChangeTracking(def.DefaultValue);
                    }
                }
            }
            else
            {
                throw new ArgumentNullException(nameof(bagSchema));
            }

            //// Make sure ODataType is always returned in changed properties.
            //PropertyDefinition odataTypePropertyDefinition;
            //if (this.ContainsProperty(PropertyBag.ODataTypePropertyName, out odataTypePropertyDefinition))
            //{
            //    this.propertyValue[odataTypePropertyDefinition].Changed = true;
            //}
        }
        ///// <summary>
        ///// Create new instance of <see cref="PropertyBag"/>.
        ///// </summary>
        ///// <param name="type">Type.</param>
        //internal PropertyBag(Type type)
        //{
        //    this.type = type;
        //    this.IsNew = false;
        //    this.InitializeBag();
        //}

        internal PropertyBag(ObjectSchema schema)
        {
            this.objectSchema = schema;
            this.InitializeBag(this.objectSchema);
            this.IsNew = false;
        }