Refactor controllers and factories to use firebase.