Lock management: store LockAccess instances in class instances

Moves some common code of converting between Lock and LockAccess to a common
place. 

Unit tests pass.