public async Task StartService() { while (true) { try { _apiEvents = await _eventDataHandler.LoadAndSaveData(); _mappedEvents = _eventMapping.Map(_apiEvents); await _distributionService.Distribute(_mappedEvents); _logger.LogInformation("EventsSevice successfully run"); } catch (Exception ex) { _logger.LogError("EventsService " + ex.StackTrace); throw; } Thread.Sleep(5000); } }