Add `lock` method for Model.