Provide configuration for an index to an index provider.

Currently this configuration specifies if the index is unique or not (used by uniqueness constraints).

Some refactorings around transaction logic, since we stumbled over it when browsing the code.