Inheritance: INotifyPropertyChanged
        private void UpdateNamespaces(IEnumerable<LogViewModel> logsToInsert)
        {
            try {
                foreach (var log in logsToInsert) {
                    var application = Applications.FirstOrDefault(m => m.Name == log.Application);
                    if (application == null) {
                        Logger.Error("[UpdateNamespaces] The application has to be set at this point.");
                        return;
                    }
                    // Try to get existing root namespace with name of application
                    var nsApplication = Namespaces.FirstOrDefault(m => m.Name == log.Application);
                    if (nsApplication == null) {
                        nsApplication = new NamespaceViewModel(log.Application, application);
                        Namespaces.Add(nsApplication);
                    }

                    // Example: Verbosus.VerbTeX.View
                    string nsLogFull = log.Namespace;
                    // Example: Verbosus
                    string nsLogPart = nsLogFull.Split(new string[] { Constants.NAMESPACE_SPLITTER }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
                    // Try to get existing namespace with name Verbosus
                    var nsChild = nsApplication.Children.FirstOrDefault(m => m.Name == nsLogPart);
                    if (nsChild == null) {
                        nsChild = new NamespaceViewModel(nsLogPart, application);
                        nsChild.IsChecked = nsApplication.IsChecked;
                        nsApplication.Children.Add(nsChild);
                        nsChild.Parent = nsApplication;
                    }
                    if (nsLogFull.Contains(Constants.NAMESPACE_SPLITTER)) {
                        HandleNamespace(nsChild, nsLogFull.Substring(nsLogFull.IndexOf(Constants.NAMESPACE_SPLITTER) + 1), application, log);
                    } else {
                        SetLogCountByLevel(log, nsChild);
                    }
                }

            } catch (Exception e) {
                Console.WriteLine("Could not update namespaces: " + e);
            }
        }
 private void SetLogCountByLevel(LogViewModel log, NamespaceViewModel ns)
 {
     ns.Count++;
     if (log.Level == LoggingLevel.TRACE) {
         ns.CountTrace++;
     } else if (log.Level == LoggingLevel.DEBUG) {
         ns.CountDebug++;
     } else if (log.Level == LoggingLevel.INFO) {
         ns.CountInfo++;
     } else if (log.Level == LoggingLevel.WARN) {
         ns.CountWarn++;
     } else if (log.Level == LoggingLevel.ERROR) {
         ns.CountError++;
     } else if (log.Level == LoggingLevel.FATAL) {
         ns.CountFatal++;
     }
 }
 private void ResetAllCount(NamespaceViewModel ns)
 {
     ns.Count = 0;
     ns.CountTrace = 0;
     ns.CountDebug = 0;
     ns.CountInfo = 0;
     ns.CountWarn = 0;
     ns.CountError = 0;
     ns.CountFatal = 0;
     foreach (var child in ns.Children) {
         ResetAllCount(child);
     }
 }
 private void HandleNamespace(NamespaceViewModel parent, string suffix, ApplicationViewModel application, LogViewModel log)
 {
     // Example: VerbTeX.View (Verbosus was processed before)
     string nsLogFull = suffix;
     // Example: VerbTeX
     string nsLogPart = nsLogFull.Split(new string[] { Constants.NAMESPACE_SPLITTER }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
     // Try to get existing namespace with name VerbTeX
     var nsChild = parent.Children.FirstOrDefault(m => m.Name == nsLogPart);
     if (nsChild == null) {
         nsChild = new NamespaceViewModel(nsLogPart, application);
         nsChild.IsChecked = parent.IsChecked;
         parent.Children.Add(nsChild);
         nsChild.Parent = parent;
     }
     if (suffix.Contains(Constants.NAMESPACE_SPLITTER)) {
         HandleNamespace(nsChild, suffix.Substring(suffix.IndexOf(Constants.NAMESPACE_SPLITTER) + 1), application, log);
     } else {
         SetLogCountByLevel(log, nsChild);
     }
 }
 private bool IsNamespaceActive(NamespaceViewModel parent, string suffix)
 {
     // Example: VerbTeX.View (Verbosus was processed before)
     string nsLogFull = suffix;
     // Example: VerbTeX
     string nsLogPart = nsLogFull.Split(new string[] { Constants.NAMESPACE_SPLITTER }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
     // Try to get existing namespace with name VerbTeX
     var nsChild = parent.Children.FirstOrDefault(m => m.Name == nsLogPart);
     if (nsChild == null) {
         return false;
     }
     if (suffix.Contains(Constants.NAMESPACE_SPLITTER)) {
         return IsNamespaceActive(nsChild, suffix.Substring(suffix.IndexOf(Constants.NAMESPACE_SPLITTER) + 1));
     }
     else {
         return nsChild.IsChecked;
     }
 }
 public void UpdateByNamespaceChange(NamespaceViewModel ns)
 {
     if (!IsActive) {
         return;
     }
     var logs = GetLogsByLevel(SelectedMinLogLevel);
     if (ns.IsChecked) {
         List<LogViewModel> logsToAdd = logs.Where(m => Name + Constants.NAMESPACE_SPLITTER + m.Namespace == ns.Fullname).ToList();
         logsToAdd.ForEach((m) => { if (IsSearchCriteriaMatch(m)) Logs.AddOrdered(m); });
     } else {
         List<LogViewModel> logsToRemove = logs.Where(m => Name + Constants.NAMESPACE_SPLITTER + m.Namespace == ns.Fullname).ToList();
         logsToRemove.ForEach((m) => { Logs.Remove(m); });
     }
 }