Js refactor

Pulls the business logic out of the controller and into a utility class

because sometimes we use the same amberSession for more than one util method. Happy to go with something else though