Commit logic is atomic

- all reasoning about existing ids done within transaction
- same database function used for all commits (inc retracts)