public void Search(Request request, int attempts) { try { SearchLogs(request).Wait(); } catch (Exception) { var state = $"{attempts} of {MaximumJobAttempts} Search Attempts, Failed. (Please see hangfire dashboard to get detailed exception logs)"; if (attempts < MaximumJobAttempts) { attempts++; _dataAccess.UpdateRequest(request.RequestUuid, state); _jobManagement.Enqueue(() => Search(request, attempts)); } else { _dataAccess.UpdateRequest(request.RequestUuid, state, true); NotifyRequester(request.RequestUuid); } throw; } }