public async Task <IActionResult> GetAndDeleteNewTestRunLogsAsync() { try { var testRunLogs = (await _meissaRepository.GetAllQueryWithRefreshAsync <TestRunLog>()).Where(x => x.Status == TestRunLogStatus.New); var testRunLogDtos = Mapper.Map <IEnumerable <TestRunLogDto> >(testRunLogs); await _meissaRepository.DeleteRangeWithSaveAsync(testRunLogs); return(Ok(testRunLogDtos)); } catch (Exception ex) { _logger.LogCritical("Exception while getting testRunLogs.", ex); return(StatusCode(500, "A problem happened while handling your request.")); } }