I had a similar script and looked at the element: addversion, as Jim mentioned. However, it is rather difficult not to get into the situation of catches. In my case, I create many elements by code. Doing this without raising events (silent updates) is quite difficult, as it also disables clearing the item cache, element indexing, etc.
. , , , , ( ) . . , , .