                 POSRootResource.existingRootResource(in: POSModelManager.shared().managedObjectContext) {
                 if let mailboxSettingsUri = rootResource.mailboxSettingsUri {
                     APIClient.sharedClient.updateMailboxSettings(uri: mailboxSettingsUri,mailboxSettings: mailboxSettings ,success: {() -> Void in
+                        self.actuallySaved = true
+                        GAEvents.event(category: self.ga_tag, action: "lagring", label: "vellykket", value: nil)
                         self.finish()
                     }, failure: ({_ in
+                        GAEvents.event(category: self.ga_tag, action: "lagring", label: "feilet", value: nil)
                         self.showAlertMessage(title: NSLocalizedString("error_contact_info_title", comment: ""), text: NSLocalizedString("error_contact_info_message", comment: ""))
                     }))
                 }
             }
         } else{
+            GAEvents.event(category: self.ga_tag, action: "lagring", label: "feil i inputfelter", value: nil)
             self.showAlertMessage(title: NSLocalizedString("invalid_email_title", comment: "invalid email"), text: NSLocalizedString("invalid_email_message", comment: "Please check"))
         }
     }

                var newEmail = [String: Any]()
                newEmail["email"] = emailAddress
                emails.append(newEmail)
            }else{
                emails[index].updateValue(emailAddress, forKey: "email")
            }
        }
        updateEmailView(emailView: sender, email: emailAddress)
    }
    
    func updateEmailView(emailView: UITextField, email: String) {

        } else if sender == email3 {
            updateEmail(index: 2, sender: sender)
        } else if sender == phonenumber {
            updatePhonenumber(new: phonenumber.text!)
        } else if sender == countryCode {
            self.mobilePhoneNumber.updateValue(countryCode.text!, forKey: "countryCode")
        }
