Extract logic for rendering queryset from table into separate method