moving sorting entries function from repeater to controller