public IActionResult Index(int?Id) { var sortedBooks = _bookRepository.GetAll().OrderByDescending(b => b.DateCreated); var books = PaginatedList <Book> .ReturnPaginated(sortedBooks, Id ?? 1, PageSize); var bookView = new BookViewModel <PaginatedList <Book> >() { Content = books, NoImagePath = _config["Books:NoImagePath"] }; _logger.LogDebug("Returning Index View with @{bookView} resources, with page size of @{pageSize} and requested page index of @{Id}", bookView, PageSize, Id); return(View(bookView)); }