Convert to using the injected session. Use isActive to reduce code.