Added unittest to reproduce #1892
Updated the unittest with test for change for both inserting and removing items.
Update cached index correctly for items in array when inserting a new item. Fixes #1892
Merge branch 'issue/1892' into develop