private async void TaskBody() { while (true) { try { var transactions = await databaseWorker.GetSentTransactions(); if (transactions != null && transactions.Any()) { foreach (var item in transactions) { await UpdateTransaction(item); } } } catch (Exception ex) { logger.LogError(ex, "Failed to get sent transactions."); } await Task.Delay(configuration.TransactionStatusWaitTime); } }