Inject service container instead of using it as a global