modify getBooksByType method and solve pagination problem