Fix history and clear old indexes when updating a resource