public async Task <IActionResult> PostTodoList(int id, TodoItemRequest todoItem) { var list = await _context.TodoList.FirstOrDefaultAsync(l => l.Id == id); if (list == null) { return(NotFound()); } var item = new TodoItem { Description = todoItem.Description, DueDate = todoItem.DueDate, Done = todoItem.Done, }; list.TodoItems.Add(item); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodoListExists(id)) { return(NotFound()); } throw; } // Publish To Topic await _todoItemPublisher.PublishAsync(new TodoItemNotification { Action = ItemAction.Created, TodoItem = _mapper.Map <TodoItemResponse>(item) }); return(NoContent()); }