         
     }
     
+    fileprivate func updateRemainingTime() {
+        
+        guard let remainingSeconds = sessionControl?.timeRemaingInSeconds() else { return }
+        
+        labelTimer.text = SecondsToHumanReadableDuration(seconds: remainingSeconds).humanReadableTime()
+    }
+    
+    fileprivate func persistAppState(developer: Developer?, sessionState: SessionState, sessionEndsOn: Date) {
+        
+        guard let sessionControl = sessionControl else { return }
+        
+        AppSettings().LastState =
+            AppState(
+                currentDeveloper: developer ?? sessionControl.developer,
+                sessionState: sessionState,
+                sessionEndsOn: sessionEndsOn
+        )
+    }
+    
+    
     private func initializeProgrammingSession() {
         
         let appSettings = AppSettings()

    @IBOutlet weak var buttonStart: UIButton!
    @IBOutlet weak var labelTimer: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        initializeNotifications()
        initializeProgrammingSession()
        
        NotificationCenter
            .default
            .addObserver(self, selector: #selector(ViewController.configurationChanged), name: UserDefaults.didChangeNotification, object: nil)

        
        updateUserInterface(developer: sessionControl!.developer)
    }

    private let inactiveOffset: CGFloat = 25
    private var disableNotificationWarningShown = false
    
    fileprivate var sessionControl: Session?
    fileprivate let updateTimer = SystemTimer(durationInSeconds: 0.25, repeatWhenExpired: true)
    
    
    @IBOutlet weak var leftDeveloperImageView: UIImageView!
    @IBOutlet weak var rightDeveloperImageView: UIImageView!
