     // MARK: - Stored Properties
     
     var note: Notes?
+    
+    var doesTextViewNeedToBeSaved: Bool!
     
     let saveOrNotSaveAlertView: FCAlertView = {
         let alertView = FCAlertView(type: .caution)

    override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
        guard !textView.text.isEmpty else {
            self.textView.endEditing(true)
            emptyNoteDeterrentAlertview.showAlert(inView: self,
                                                  withTitle: "Empty Note Detected",
                                                  withSubtitle: "You aren't allowed to save an empty note.",
                                                  withCustomImage: nil,

        //      print("c) I am of type: \(type(of:self.presentingViewController))")
        //    }
        
        if self.doesTextViewNeedToBeSaved == true {
            self.saveOrNotSaveAlertView.showAlert(inView: self,
                                                  withTitle: "Unsaved Change Detected",
                                                  withSubtitle: "Do you want to save or not save?",
                                                  withCustomImage: nil,
                                                  withDoneButtonTitle: nil,
                                                  andButtons: ["Don't Save", "Save"])
        }
        else {
            let isPresentingFromAddButton = self.presentingViewController is UINavigationController
            if isPresentingFromAddButton {
                self.dismiss(animated: true, completion: nil)
            }
            else {
                //      print("d) I am of type: \(type(of: self.presentingViewController))")
                _ = self.navigationController?.popViewController(animated: true)
            }
        }
    }
    
