     override func viewWillAppear(_ animated: Bool)
     {
         super.viewWillAppear(animated)
-        if !(viewModel?.isLoggedIn)!
-        {
-            let errorMessage = YSError(errorType: YSErrorType.notLoggedInToDrive, messageType: Theme.warning, title: "Warning", message: "Could not get list, please login", buttonTitle: "Login", debugInfo: "")
-            errorDidChange(viewModel: viewModel!, error: errorMessage)
-        }
+        showNotLoggedInMessage()
+    }
+    
+    func showNotLoggedInMessage()
+    {
+        guard let viewModel = viewModel, !viewModel.isLoggedIn else { return }
+        let errorMessage = YSError(errorType: YSErrorType.notLoggedInToDrive, messageType: Theme.warning, title: "Warning", message: "Could not get list, please login", buttonTitle: "Login", debugInfo: "")
+        errorDidChange(viewModel: viewModel, error: errorMessage)
     }
     
     func deleteToolbarButtonTapped(_ sender: UIBarButtonItem)

    
    func getFiles()
    {
        if !(viewModel?.isLoggedIn)!
        {
            tableView.mj_header.endRefreshing()
            return
        }

        switch error.errorType
        {
        case .cancelledLoginToDrive, .couldNotLoginToDrive, .notLoggedInToDrive:
            message.buttonTapHandler =
                { _ in
                self.viewModel?.loginToDrive()
                SwiftMessages.hide()
            }
            break
            
        case .loggedInToToDrive:
            message.buttonTapHandler =
