private void Retry(Action action) { int counter = 0; while (true) { try { action(); break; } catch (Exception) { counter++; if (counter >= NumberOfRetries) { throw; } _asyncService.Sleep(RetryMillis); } } }