moved task logic from the view to the service layer