Move the check for offline mode into a dedicated method