refactor simple crud, add pagination support