private void HandlePost(PathResult query, Dictionary <string, object> requestDictionary) { var parentId = query.Id; var nodeType = query.NodeType; if (requestDictionary.TryGetValue("parentId", out object dataParentId)) { parentId = dataParentId.ToString(); } if (nodeType == null) { if (requestDictionary.TryGetValue("type", out object dataType)) { nodeType = factory.GetTypeByName(dataType.ToString()); } } var node = container.GetById(parentId); if (nodeType != null) { if (node != null) { var newnode = Activator.CreateInstance(query.NodeType) as INode; newnode.Apply(requestDictionary); node.Add(newnode); query.SetId(newnode.Id); } else { throw new KeyNotFoundException("parentId"); } } else { throw new KeyNotFoundException("type"); } }