public Question GetQuestionForToday() { Question newQuestion = null; var attempts = 0; while (attempts < 5) { try { var task = client.GetReport(DateTime.Now.Date); task.Wait(); newQuestion = task.Result; attempts = 5; } catch { attempts++; } } if (newQuestion == null) { return(null); } else { questionRepo.AddItem(newQuestion); return(newQuestion); } }