Automatically ensuring indexes on save