Move controller code form sub View to controller