add method to save changes and getting indexwriter