Provides a easy way to use optimistic/pessimistic locking.