public void RemoveUnsavedChange(LocaleUnsavedChangesData change)
 {
     if (UnsavedChanges.Remove(change))
     {
         Parent?.UpdateUnsavedChanges();
         ChangesUnsaved = UnsavedChanges.Count > 0;
     }
 }
        public void AddUnsavedChange(ILocaleKeyEntry entry, LocaleUnsavedChangesData unsavedChange)
        {
            // Remove this unsaved change if it matches a previous one
            var matchedChange = UnsavedChanges.FirstOrDefault(x => LocaleUnsavedChangeMatch(x, unsavedChange));

            if (matchedChange != null)
            {
                //Log.Here().Activity($"Removing unsaved change as it matches a previous value '{matchedChange.ChangeType} | {matchedChange.LastValue} => {matchedChange.NewValue}'.");
                RemoveUnsavedChange(matchedChange);
                entry.ChangesUnsaved = false;
            }
            else
            {
                //Log.Here().Activity($"Added unsaved change '{unsavedChange.ChangeType} | {unsavedChange.LastValue} => {unsavedChange.NewValue}'.");
                UnsavedChanges.Add(unsavedChange);
                entry.ChangesUnsaved = ChangesUnsaved = Parent.ChangesUnsaved = true;
            }
        }
 private bool LocaleUnsavedChangeMatch(LocaleUnsavedChangesData a, LocaleUnsavedChangesData b)
 {
     return(a.KeyEntry == b.KeyEntry && a.ChangeType == b.ChangeType && a.NewValue == b.LastValue);
 }