public async Task <List <SentHistoryRecord> > GetSentHistoryAsync(int count, int since)
        {
            try
            {
                await using var context = new SmsSenderDbContext(_dbContextOptionsBuilder.Options);

                if (since > 0)
                {
                    var data = await context.SentHistory.Where(s => s.Id < since).OrderByDescending(e => e.Id).Take(count).ToListAsync();

                    return(data);
                }
                else
                {
                    var data = await context.SentHistory.OrderByDescending(e => e.Id).Take(count).ToListAsync();

                    return(data);
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Cannot retrieve sms history records from DB");
                throw;
            }
        }
        private async Task <string> SaveSentHistoryRecord(SentHistoryRecord record)
        {
            try
            {
                await using var context = new SmsSenderDbContext(_dbContextOptionsBuilder.Options);
                var dbResult = await context.SentHistory.AddAsync(record);

                await context.SaveChangesAsync();

                return(dbResult.Entity.Id.ToString());
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Cannot store sms history record for {maskedPhone} (provider: {provider})", record.MaskedPhone, record.Provider);
                throw;
            }
        }