Refactored book management querries and unit tests