wrap modify_index in a transaction

If we failed to add an object it could leave the view in an inconsistent state
which caused the whole process transaction to fail.