diff --git a/Wino.Core.Domain/Enums/EmailGroupingType.cs b/Wino.Core.Domain/Enums/EmailGroupingType.cs
new file mode 100644
index 00000000..703cc21a
--- /dev/null
+++ b/Wino.Core.Domain/Enums/EmailGroupingType.cs
@@ -0,0 +1,10 @@
+namespace Wino.Core.Domain.Enums;
+
+///
+/// Grouping options for emails
+///
+public enum EmailGroupingType
+{
+ ByFromName,
+ ByDate
+}
diff --git a/Wino.Mail.ViewModels/Collections/GroupedEmailCollection.cs b/Wino.Mail.ViewModels/Collections/GroupedEmailCollection.cs
deleted file mode 100644
index 58865e9a..00000000
--- a/Wino.Mail.ViewModels/Collections/GroupedEmailCollection.cs
+++ /dev/null
@@ -1,1822 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.Linq;
-using CommunityToolkit.Mvvm.ComponentModel;
-using CommunityToolkit.Mvvm.Messaging;
-using CommunityToolkit.Mvvm.Messaging.Messages;
-using Wino.Core.Domain.Entities.Mail;
-using Wino.Mail.ViewModels.Data;
-
-namespace Wino.Mail.ViewModels.Collections;
-
-///
-/// Grouping options for emails
-///
-public enum EmailGroupingType
-{
- ByFromName,
- ByDate
-}
-
-///
-/// Sorting options for emails within groups
-///
-public enum EmailSortDirection
-{
- Ascending,
- Descending
-}
-
-///
-/// Collection that automatically groups MailItemViewModels with ThreadMailItemViewModels in a flat structure for ItemsView.
-/// All emails are in the same flat list with proper selection support. Thread emails are placed consecutively after their expander.
-///
-public partial class GroupedEmailCollection : ObservableObject, IRecipient>, IDisposable
-{
- public event EventHandler SelectionChanged;
-
- private readonly ObservableCollection _sourceItems = [];
- private readonly Dictionary _groupHeaders = [];
- private readonly Dictionary _groupHeaderIndexCache = [];
- private readonly Dictionary> _groupItems = [];
- private readonly Dictionary _threadExpanders = [];
- private readonly HashSet _mailCopyIdHashSet = [];
- private readonly HashSet _selectedVisibleItems = [];
- private bool _disposed;
- private bool _isUpdating;
-
- [ObservableProperty]
- private EmailGroupingType groupingType = EmailGroupingType.ByDate;
-
- [ObservableProperty]
- private EmailSortDirection sortDirection = EmailSortDirection.Descending;
-
- // Tracks the number of currently selected visible mail items. Notify derived bools when changed.
- [ObservableProperty]
- [NotifyPropertyChangedFor(nameof(HasSelectedItems))]
- [NotifyPropertyChangedFor(nameof(HasSingleItemSelected))]
- [NotifyPropertyChangedFor(nameof(HasMultipleItemsSelected))]
- [NotifyPropertyChangedFor(nameof(IsAllItemsSelected))]
- public partial int SelectedVisibleCount { get; set; }
-
- ///
- /// Indicates whether there are any selected visible items.
- ///
- public bool HasSelectedItems => SelectedVisibleCount > 0;
-
- ///
- /// Indicates whether there is exactly one selected visible item.
- ///
- public bool HasSingleItemSelected => SelectedVisibleCount == 1;
-
- ///
- /// Indicates whether there are multiple selected visible items.
- ///
- public bool HasMultipleItemsSelected => SelectedVisibleCount > 1;
-
- ///
- /// Indicates whether all mail items are currently selected.
- /// Counts all mail items including those in threads, regardless of thread expansion state.
- ///
- public bool IsAllItemsSelected
- {
- get
- {
- var totalMailItems = _sourceItems.Count;
- if (totalMailItems == 0) return false;
-
- var selectedCount = 0;
-
- // Count selected standalone emails (not in threads)
- selectedCount += _sourceItems.Count(e => e.IsSelected && !e.IsDisplayedInThread);
-
- // Count selected emails in threads
- foreach (var expander in _threadExpanders.Values)
- {
- if (expander.IsSelected)
- {
- // If thread is selected, all emails in the thread are considered selected
- selectedCount += expander.ThreadEmails.Count;
- }
- else
- {
- // If thread is not selected, count only individually selected emails within the thread
- selectedCount += expander.ThreadEmails.Count(e => e.IsSelected);
- }
- }
-
- return selectedCount == totalMailItems;
- }
- }
-
- public GroupedEmailCollection()
- {
- // Create a flat collection for ItemsView with headers, expanders and emails mixed
- Items = [];
-
- // Subscribe to source collection changes to update grouping
- _sourceItems.CollectionChanged += OnSourceItemsChanged;
-
- // Register for PropertyChanged messages
- WeakReferenceMessenger.Default.Register>(this);
-
- RefreshGrouping();
- }
-
- ///
- /// Flat observable collection containing group headers, thread expanders, and email items for ItemsView binding.
- /// Structure: GroupHeader -> [ThreadExpander -> ThreadEmail1, ThreadEmail2, ...] -> StandaloneEmail1 -> StandaloneEmail2
- ///
- public ObservableCollection