Moving the code to calculate the filter dates to inside the model so now it must not be called twice.