refactor out package mangemtn into a package manager service class isntead of doing it all in the controller