Refactored firebase logic out of controllers and into services