Refactor firebase into angular service