Refactoring environment_service to environment model