save state before creating separate connection class