public JsonResult AddNewNode(NodeVM nodeVm) { if (!string.IsNullOrEmpty(nodeVm.Name)) { var newNodeId = _nodeRepository.AddNode(nodeVm); return(Json(new { success = true, nodeName = nodeVm.Name, newNodeId, nodeParentId = nodeVm.ParentNodeId })); } return(Json(new { success = true, message = "Name cannot be empty!" })); }