public async Task <ActionResult <AddToDoResponse> > Post([FromBody] ToDoRequest model) { if (!ModelState.IsValid) { return(BadRequest(model)); } bool isValid = Guid.TryParse(model.UserId, out var guidOutput); if (!isValid) { return(BadRequest(model)); } if (guidOutput.ToString() != AppUser.Id) { return(Unauthorized(new { message = "Unauthorized" })); } // create new todo var todoResponse = await _toDoService.AddToDoAsync(DataExtensions.ToToDo(model, AppUser.Id)); return(todoResponse.Success ? Ok(todoResponse) : BadRequest(todoResponse)); }