Refactored "doPagination" and ResourceOptionInterface.