Lock repository when working with it