public static async Task UpdatePlaylist(IPlaylist playlist, IChannel selectedChannel)
        {
            switch (playlist.Site)
            {
            case SiteType.YouTube:

                HashSet <string> dbids         = selectedChannel.ChannelItems.Select(x => x.ID).ToHashSet();
                List <string>    plitemsIdsNet = await YouTubeSite.GetPlaylistItemsIdsListNetAsync(playlist.ID, 0).ConfigureAwait(false);

                List <string> ids = plitemsIdsNet.Where(netid => !playlist.PlItems.Contains(netid)).ToList();
                if (!ids.Any())
                {
                    return;
                }
                var lstInDb   = new List <string>();
                var lstNoInDb = new List <string>();
                foreach (string id in ids)
                {
                    if (dbids.Contains(id))
                    {
                        lstInDb.Add(id);
                    }
                    else
                    {
                        lstNoInDb.Add(id);
                    }
                }
                foreach (string id in lstInDb)
                {
                    await db.UpdatePlaylistAsync(playlist.ID, id, selectedChannel.ID).ConfigureAwait(false);

                    playlist.PlItems.Add(id);
                }

                IEnumerable <List <string> > chanks = lstNoInDb.SplitList();
                foreach (List <string> list in chanks)
                {
                    List <VideoItemPOCO> res = await YouTubeSite.GetVideosListByIdsAsync(list).ConfigureAwait(false);    // получим скопом

                    foreach (IVideoItem vi in res.Select(poco => VideoItemFactory.CreateVideoItem(poco, SiteType.YouTube)))
                    {
                        vi.SyncState = SyncState.Added;
                        if (vi.ParentID == selectedChannel.ID)
                        {
                            selectedChannel.AddNewItem(vi);
                            await db.InsertItemAsync(vi).ConfigureAwait(false);

                            await db.UpdatePlaylistAsync(playlist.ID, vi.ID, selectedChannel.ID).ConfigureAwait(false);
                        }
                        else
                        {
                            selectedChannel.ChannelItems.Add(vi);
                        }
                        playlist.PlItems.Add(vi.ID);
                    }
                }

                break;
            }
        }
        private static async Task InsertNewItems(IEnumerable <string> trueIds,
                                                 IChannel channel,
                                                 string playlistId          = null,
                                                 ICollection <string> dbIds = null,
                                                 Action <IVideoItem, object> stateAction = null)
        {
            List <VideoItemPOCO> res = await YouTubeSite.GetVideosListByIdsAsync(trueIds).ConfigureAwait(true); // получим скопом

            IEnumerable <IVideoItem> result =
                res.Select(poco => VideoItemFactory.CreateVideoItem(poco, channel.Site, false, SyncState.Added))
                .Reverse()
                .Where(vi => vi.ParentID == channel.ID)
                .ToList();
            await db.InsertChannelItemsAsync(result).ConfigureAwait(false);

            foreach (IVideoItem vi in result)
            {
                channel.AddNewItem(vi);
                stateAction?.Invoke(vi, SyncState.Added);
                if (playlistId != null)
                {
                    await db.UpdatePlaylistAsync(playlistId, vi.ID, channel.ID).ConfigureAwait(false);
                }
                if (dbIds == null)
                {
                    continue;
                }
                if (!dbIds.Contains(vi.ID))
                {
                    dbIds.Add(vi.ID);
                }
            }
        }
        public async Task GetListVideoByIdsAsync()
        {
            var lst = new List <string> {
                "-wA6Qj4oF2E"
            };

            List <VideoItemPOCO> res = await YouTubeSite.GetVideosListByIdsAsync(lst).ConfigureAwait(false);

            Assert.AreEqual(res.Count(), 1);
        }