Refactoring of deals controller in angular