public ActionResult Post([FromBody] CreateTaskListRequest request) { if (!ModelState.IsValid) { return(BadRequest()); } else { var userExists = _taskService.Users.Any(i => i.UserId == request.UserId && i.IsDeleted != true); if (userExists) { var itemExists = _taskService.TaskLists.Any(i => i.Title == request.TaskListTitle && i.UserId == request.UserId && i.IsDeleted != true); if (itemExists) { return(BadRequest()); } TaskList item = new Models.TaskList(); item.TaskListId = Guid.NewGuid().ToString().Replace("-", ""); item.UserId = request.UserId; item.CreatedOnUtc = DateTime.UtcNow; item.UpdatedOnUtc = DateTime.UtcNow; item.Title = request.TaskListTitle; _taskService.AddTaskList(item); HttpContext.Response.StatusCode = 201; return(Ok()); } else { return(BadRequest()); } } }