public void TestMethod_In2()
            {
                var str      = "2, 6, 7";
                var expected = "A IN (2,6,7)";
                var actual   = DbHelper.GetWhereString(SqlFilter.In("A", 2, 6, 7)); //   Array.ForEach(array, i => )

                Assert.AreEqual(expected, actual);
            }
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    var apiClient = new TvYandexApiClient();
                    var schedule  = await apiClient.GetSchedule(DateTime.UtcNow);



                    var idApiList = new List <int>();
                    foreach (var item in schedule.schedule.schedules)
                    {
                        idApiList.Add(item.channel.id);
                    }

                    var dbItem = ChannelDataContext.Instance
                                 .GetList(100,
                                          SqlFilter.In("IdFromApi", idApiList))
                                 .ToDictionary(x => x.IdFromApi, x => x.Id);

                    foreach (var channel in schedule.schedule.schedules)
                    {
                        try
                        {
                            if (dbItem.ContainsKey(channel.channel.id))
                            {
                                ChannelDataContext.Instance.Update(new Channel(), x =>
                                {
                                    int val;
                                    dbItem.TryGetValue(channel.channel.id, out val);
                                    x.Id          = val;
                                    x.Name        = channel.channel.familyTitle;
                                    x.Description = channel.channel.title;
                                    x.UpdatedUtc  = DateTime.UtcNow;
                                    x.IdFromApi   = channel.channel.id;
                                });
                            }

                            else
                            {
                                ChannelDataContext.Instance.Create(new Channel(), x =>
                                {
                                    x.Name        = channel.channel.familyTitle;
                                    x.Description = channel.channel.title;

                                    x.UpdatedUtc = DateTime.UtcNow;
                                    x.IdFromApi  = channel.channel.id;
                                });
                            }
                        }
                        catch (Exception ex)
                        {
                            LogHelper.LogError(ex);
                        }
                    }


                    await Task.Delay(TimeSpan.FromMinutes(3), stoppingToken).ConfigureAwait(false);
                }

                catch (OperationCanceledException ex)
                {
                    LogHelper.LogInfo(ex);
                }

                catch (Exception ex)
                {
                    LogHelper.LogError(ex);
                }
            }
        }