Move summary stats functionality from controller to model