Rework repository events
Increase query code coverage