if (book == null || !book.isBorrowed()) {
return Response.status(Status.NOT_FOUND).build();
}
Customer customer = book.getBorrowedBy();
return HateoasResponse.ok(new LoanDto(customer.getId(), book.getId()))
.selfLink(LinkableIds.LOAN_DETAILS_ID, book.getId())
.link(LinkableIds.BOOK_DETAILS_ID, Rels.BOOK, book.getId())
.link(LinkableIds.CUSTOMER_DETAILS_ID, Rels.CUSTOMER, customer.getId())
.selfLink(LinkableIds.LOAN_RETURN_ID, id).build();
}