Factor out lockTable to a class method