public IActionResult PatchTask(int taskId, [FromBody] JsonPatchDocument <TaskForPartialUpdateDTO> patchDocument) { var taskToUpdate = _repo.GetTask(taskId); if (taskToUpdate == null) { return(NotFound()); } var taskWithUpdatedValues = ModelsMapping.GetTaskForPartialUpdateDto(taskToUpdate); patchDocument.ApplyTo(taskWithUpdatedValues); if (!ModelState.IsValid) { return(BadRequest()); } ValuesUpdater.ApplyPatchToTaskEntity(taskToUpdate, taskWithUpdatedValues); _repo.SaveChanges(); return(Ok()); }