The thumbnails array appears to be unused.  On the other hand, the insertPosition value is probably required  to ensure that the thumbanil gets inserted at the correct spot.