move some date-setting logic from controllers to models