public async Task <IActionResult> Create(ToDoItemViewModel toDoItem) { try { if (ModelState.IsValid) { await viewModelService.AddItemAsync(toDoItem); return(RedirectToAction(nameof(Index))); } else { return(View(toDoItem)); } } catch (System.Exception) { ModelState.AddModelError(string.Empty, "An error occured saving task."); } return(View(nameof(Index))); }