Fix race condition in Versionable behaviour

When 2 requests try to update a versionable model at the same time, a race condition occurs. If the current version-number of 42, they will both try to update it to version 43. One of these requests will fail, due the uniqueness constraint on the Version table (id-version should be unique).

This PR wraps the versionable update in a transaction that locks the version table