add flush method to repository