'Override GenericAPIView.paginate_queryset for the purpose of eventing'

def paginate_queryset(self, queryset):

    page = super(BookmarksListView, self).paginate_queryset(queryset)
    course_id = self.request.query_params.get('course_id')
    if course_id:
        try:
            CourseKey.from_string(course_id)
        except InvalidKeyError:
            return page
    event_data = {'list_type': 'all_courses', 'bookmarks_count': self.paginator.page.paginator.count, 'page_size': self.paginator.page.paginator.per_page, 'page_number': self.paginator.page.number}
    if (course_id is not None):
        event_data['list_type'] = 'per_course'
        event_data['course_id'] = course_id
    eventtracking.tracker.emit('edx.bookmark.listed', event_data)
    return page
