move sections function from the repository to the controller