Refactoring checkout a book code