private async void ChatClearExecute(Chat chat)
        {
            var dialog = new DeleteChatView(ProtoService, chat, true);

            var confirm = await dialog.ShowQueuedAsync();

            if (confirm == ContentDialogResult.Primary)
            {
                Delegate?.ShowChatsUndo(new[] { chat }, UndoType.Clear, items =>
                {
                    var undo = items.FirstOrDefault();
                    if (undo == null)
                    {
                        return;
                    }

                    _deletedChats.Remove(undo.Id);
                    Handle(undo.Id, undo.Order);
                }, items =>
                {
                    foreach (var delete in items)
                    {
                        ProtoService.Send(new DeleteChatHistory(delete.Id, false, dialog.IsChecked));
                    }
                });
            }
        }
        private async void ChatDeleteExecute(Chat chat)
        {
            var dialog = new DeleteChatView(ProtoService, chat, false);

            var confirm = await dialog.ShowQueuedAsync();

            if (confirm == ContentDialogResult.Primary)
            {
                var check = dialog.IsChecked == true;

                _deletedChats[chat.Id] = true;
                Handle(chat.Id, 0);

                Delegate?.ShowChatsUndo(new[] { chat }, UndoType.Delete, items =>
                {
                    var undo = items.FirstOrDefault();
                    if (undo == null)
                    {
                        return;
                    }

                    _deletedChats.Remove(undo.Id);
                    Handle(undo.Id, undo.Order);
                }, async items =>
                {
                    var delete = items.FirstOrDefault();
                    if (delete == null)
                    {
                        return;
                    }

                    if (delete.Type is ChatTypeSecret secret)
                    {
                        await ProtoService.SendAsync(new CloseSecretChat(secret.SecretChatId));
                    }
                    else if (delete.Type is ChatTypeBasicGroup || delete.Type is ChatTypeSupergroup)
                    {
                        await ProtoService.SendAsync(new LeaveChat(delete.Id));
                    }

                    var user = CacheService.GetUser(delete);
                    if (user != null && user.Type is UserTypeRegular)
                    {
                        ProtoService.Send(new DeleteChatHistory(delete.Id, true, check));
                    }
                    else
                    {
                        if (delete.Type is ChatTypePrivate privata && check)
                        {
                            await ProtoService.SendAsync(new BlockUser(privata.UserId));
                        }

                        ProtoService.Send(new DeleteChatHistory(delete.Id, true, false));
                    }
                });
            }
        }