private async Task SendData(MarkedEpisodes episodes)
        {
            var success = await _client.GetApi(episodes.User.ApiVersion).SyncEpisodes(episodes.User, episodes.SeenEpisodes, episodes.UnSeenEpisodes);

            _logger.LogInformation("Synced {0} episodes: {1}", episodes.SeenEpisodes.Count + episodes.UnSeenEpisodes.Count, success ? "success" : "failed");

            episodes.SeenEpisodes.Clear();
            episodes.UnSeenEpisodes.Clear();
        }
        public async Task AddEvent(UserConfig user, UserDataSaveEventArgs args)
        {
            if (args.Item is not Episode episode)
            {
                return;
            }

            var episodes = _episodes.FirstOrDefault(e => e.User.Equals(user));

            if (episodes == default(MarkedEpisodes))
            {
                episodes = new MarkedEpisodes {
                    User = user
                };
                _episodes.Add(episodes);
            }

            if (!episodes.CurrentSeriesId.Equals(episode.Series.Id))
            {
                if (episodes.CurrentSeriesId != default)
                {
                    await SendData(episodes);
                }
                episodes.CurrentSeriesId = episode.Series.Id;
            }

            if (args.UserData.Played)
            {
                episodes.SeenEpisodes.Add(episode);
                if (episodes.UnSeenEpisodes.Contains(episode))
                {
                    episodes.UnSeenEpisodes.Remove(episode);
                }
            }
            else
            {
                episodes.UnSeenEpisodes.Add(episode);
                if (episodes.SeenEpisodes.Contains(episode))
                {
                    episodes.SeenEpisodes.Remove(episode);
                }
            }

            Postpone();
        }