private async void Signin()
        {
            ErrorMessage = "";
            try {
                var(result, message) = await m_AnilibriaApiService.Authentification(Email, Password, TwoFACode);

                if (result)
                {
                    ChangePage("Releases", null);
                    RefreshOptions?.Invoke();
                    await ChangeUserSession();

                    if (m_AnilibriaApiService.IsAuthorized())
                    {
                        ObserverEvents.FireEvent(
                            "showMessage",
                            new MessageModel {
                            Header  = "Авторизация",
                            Message = "Вы успешно вошли в аккаунт"
                        }
                            );
                    }
                }
                else
                {
                    ErrorMessage = message;
                }
            } catch {
                ErrorMessage = "Ошибка авторизации";
            }
        }
        private async void SaveVideo(string identifier)
        {
            var id          = GetIdentifierFromString(identifier);
            var quality     = identifier.Replace(id, "");
            var enumQuality = quality == "HD" ? VideoQuality.HD : VideoQuality.SD;
            var videoId     = Convert.ToInt32(id);
            var release     = m_DownloadService.GetDownloadRelease(SelectedDownload.ReleaseId);
            var video       = release.Videos.FirstOrDefault(a => a.Id == videoId && a.Quality == enumQuality);

            var savePicker = new FileSavePicker();

            savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            savePicker.FileTypeChoices.Add("Video file", new List <string> ()
            {
                ".mp4"
            });
            savePicker.SuggestedFileName = "Video";

            var file = await savePicker.PickSaveFileAsync();

            var failed = false;

            if (file != null)
            {
                CachedFileManager.DeferUpdates(file);

                try {
                    var storageFile = await StorageFile.GetFileFromPathAsync(video.DownloadedPath);

                    using (var inputStream = await storageFile.OpenStreamForReadAsync())
                        using (var outputStream = await file.OpenStreamForWriteAsync()) {
                            await inputStream.CopyToAsync(outputStream);
                        }
                } catch {
                    failed = true;
                }

                var status = await CachedFileManager.CompleteUpdatesAsync(file);

                if (status != FileUpdateStatus.Complete)
                {
                    failed = true;
                }

                if (failed)
                {
                    ObserverEvents.FireEvent(
                        "showMessage",
                        new MessageModel {
                        Header  = $"Копирование серии",
                        Message = $"Не удалось скопировать серию"
                    }
                        );
                }
            }
        }
        private void FinishHandler(DownloadReleaseEntity downloadRelease, int videoId, long downloaded, VideoQuality videoQuality)
        {
            var release = m_Downloads.FirstOrDefault(a => a.ReleaseId == downloadRelease.ReleaseId);

            if (release == null)
            {
                return;
            }

            release.CurrentDownloadVideo = downloadRelease.Videos.FirstOrDefault(a => a.IsProgress)?.Id ?? 0;
            release.DownloadProgress     = downloadRelease.Videos.Count(a => a.IsProgress);
            release.DownloadedHdVideos   = downloadRelease.Videos.Count(a => a.IsDownloaded && a.Quality == VideoQuality.HD);
            release.AllDownloadedSize    = downloadRelease.Videos.Any() ? FileHelper.GetFileSize((long)downloadRelease.Videos.Sum(a => (long)a.DownloadedSize)) : FileHelper.GetFileSize(0);
            release.DownloadedSdVideos   = downloadRelease.Videos.Count(a => a.IsDownloaded && a.Quality == VideoQuality.SD);
            release.DownloadSpeed        = "";
            release.NotDownloadedVideos  = downloadRelease.Videos.Count(a => !a.IsDownloaded && !a.IsProgress);
            release.Active = downloadRelease.Active && downloadRelease.Videos.Any(a => a.IsProgress);


            var displayQuality = GetDisplayQuality(videoQuality);
            var video          = release.Videos.Where(a => a.Order == videoId && a.Quality == displayQuality).FirstOrDefault();

            if (video == null)
            {
                return;
            }

            video.IsProgress     = false;
            video.DownloadedSize = FileHelper.GetFileSize(downloaded);
            video.IsDownloaded   = true;

            if (IsFullNotification)
            {
                ObserverEvents.FireEvent(
                    "showMessage",
                    new MessageModel {
                    Header  = $"Скачана {video.Name} {video.Quality}",
                    Message = $"В релизе " + release.Title
                }
                    );
            }
        }