rest of locking implementation, applied to associations