private void ItemsSource_Filter(object sender, FilterEventArgs e)
        {
            // Edge case: filter text is empty
            if (string.IsNullOrWhiteSpace(FilterText))
            {
                e.Accepted = true;
                return;
            }

            e.Accepted = false;

            // BookmarkBox
            if (e.Item is BookmarkBox)
            {
                BookmarkBox current = e.Item as BookmarkBox;
                if (current.Bookmark.Name.ToUpper().Contains(FilterText.ToUpper()))
                {
                    e.Accepted = true;
                }
            }
            // ReferenceBox
            else if (e.Item is ReferenceBox)
            {
                ReferenceBox current = e.Item as ReferenceBox;
                if (current.Reference.Name.ToUpper().Contains(FilterText.ToUpper()))
                {
                    e.Accepted = true;
                }
            }
            // Bookmark
            else if (e.Item is Bookmark)
            {
                Bookmark current = e.Item as Bookmark;
                if (current.Name.ToUpper().Contains(FilterText.ToUpper()))
                {
                    e.Accepted = true;
                }
            }
            // Reference
            else if (e.Item is Reference)
            {
                Reference current = e.Item as Reference;
                if (current.Name.ToUpper().Contains(FilterText.ToUpper()))
                {
                    e.Accepted = true;
                }
            }
            else
            {
                throw new ArgumentException("Invalid argument type!");
            }
        }
        public void CheckChangedDataView(object input)
        {
            ReferenceBox current_reference_box = input as ReferenceBox;

            // 1. If user checked add article to reference
            if (current_reference_box.IsChecked)
            {
                try
                {
                    new ReferenceRepo().AddArticleToReference(current_reference_box.Reference, _article);

                    // Tack
                    Couple info = new Couple("Reference", "Add", _article.Title, current_reference_box.Reference.Name);
                    new Tracker(new User()
                    {
                        Username = "******", Admin = 1
                    }).TrackCoupling <Couple>(info);
                }
                catch (Exception e)
                {
                    new BugTracker().Track("Reference Manager", "Add article to reference", e.Message, e.StackTrace);
                    _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error));
                }
            }
            // 2. If user unchecked remove article from bookmark
            else
            {
                try
                {
                    new ReferenceRepo().RemoveArticleFromReference(current_reference_box.Reference, _article);

                    // Track
                    Couple info = new Couple("Reference", "Remove", _article.Title, current_reference_box.Reference.Name);
                    new Tracker(new User()
                    {
                        Username = "******", Admin = 1
                    }).TrackCoupling <Couple>(info);
                }
                catch (Exception e)
                {
                    new BugTracker().Track("Reference Manager", "Remove article from reference", e.Message, e.StackTrace);
                    _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error));
                }
            }
        }
        public void CheckChangedDataEntry(object input)
        {
            ReferenceBox current_reference_box = input as ReferenceBox;

            // If Bookmarks contains the input remove it
            if (_references.Exists(el => el.Name == current_reference_box.Reference.Name))
            {
                try
                {
                    int index = _references.FindIndex(el => el.Name == current_reference_box.Reference.Name);
                    _references.RemoveAt(index);
                }
                catch (Exception e)
                {
                    new BugTracker().Track("Reference Manager (Data Entry)", "Remove article from reference", e.Message, e.StackTrace);
                    _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error));
                }
            }
            // If Bookmarks doesn't contain the input add it
            else
            {
                _references.Add(current_reference_box.Reference);
            }
        }