protected override void ReadAddCollectionItem(ref ObjectContext objectContext, Type elementType, CollectionDescriptor collectionDescriptor, object thisObject, int index)
        {
            var scriptCollection = (ScriptCollection)objectContext.Instance;

            object value = null;
            bool needAdd = true; // If we could get existing value, no need add to collection
            if (scriptCollection.Count > index)
            {
                value = scriptCollection[index];
                needAdd = false;
            }

            value = ReadCollectionItem(ref objectContext, value, elementType);
            if (needAdd)
                collectionDescriptor.CollectionAdd(thisObject, value);
        }
 /// <summary>
 /// Reads and adds item to the collection.
 /// </summary>
 /// <param name="objectContext">The object context.</param>
 /// <param name="elementType">Type of the element.</param>
 /// <param name="collectionDescriptor">The collection descriptor.</param>
 /// <param name="thisObject">The this object.</param>
 /// <param name="index">The index.</param>
 protected virtual void ReadAddCollectionItem(ref ObjectContext objectContext, Type elementType, CollectionDescriptor collectionDescriptor, object thisObject, int index)
 {
     var value = ReadCollectionItem(ref objectContext, null, elementType);
     collectionDescriptor.CollectionAdd(thisObject, value);
 }