Added the flush() method, implemented it for existing repositories