public IActionResult PostDescription([FromBody] NodeDescription value)
        {
            try
            {
                if (value.Id == 0)
                {
                    BadRequest("Id cannot be 0(Zero)");
                }
                var nodeDescription = _cgDbContext.NodeDescriptions.FirstOrDefault(s => s.Id == value.Id);
                if (nodeDescription == null)
                {
                    nodeDescription = new NodeDescription()
                    {
                        Id = value.Id,
                    };
                    _cgDbContext.NodeDescriptions.Add(nodeDescription);
                }

                nodeDescription.Title       = value.Title;
                nodeDescription.Description = value.Description;
                nodeDescription.IsCondition = value.IsCondition;


                _cgDbContext.SaveChanges();
                return(Ok(nodeDescription));
            }
            catch (Exception ex)
            {
                return(BadRequest("An error has occured cannot save data"));
            }
        }
        public IActionResult Post(int?parentId, [FromBody] NodeDto value)
        {
            try
            {
                var node = _cgDbContext.Nodes.Include(s => s.NodeRelation).FirstOrDefault(s => s.Id == value.Id);
                if (node == null)
                {
                    node          = new Node();
                    node.rowguid  = new Guid();
                    node.IsActive = true;
                    _cgDbContext.Nodes.Add(node);
                }

                node.Page       = value.Page;
                node.NodeTypeId = value.NodeTypeId;
                node.Name       = value.Name;
                //node.IsActive = value.IsActive;

                if (node.NodeRelation == null)
                {
                    node.NodeRelation = new List <NodeRelation>();
                }

                if (value.ParentNodes == null)
                {
                    value.ParentNodes = new List <int>();
                }
                foreach (var pr in value.ParentNodes)
                {
                    var parentNode = node.NodeRelation.FirstOrDefault(s => s.ParentNodeId == pr);
                    if (parentNode == null)
                    {
                        parentNode = new NodeRelation()
                        {
                            ParentNodeId = pr
                        };

                        node.NodeRelation.Add(parentNode);
                    }
                    parentNode.IsActive = true;
                }

                foreach (var parent in node.NodeRelation)
                {
                    if (!value.ParentNodes.Contains(parent.ParentNodeId))
                    {
                        parent.IsActive = false;
                    }
                }
                _cgDbContext.SaveChanges();
                return(Ok(_mapper.Map <NodeDto>(node)));
            }
            catch (Exception ex)
            {
                return(BadRequest("An error has occured cannot save data"));
            }
        }