Use a M2M intermediate model for sorting and different time ranges