abstract association and refactor, add option for result per page