Merge "Refactor duplicate code from lock managers"