public virtual void CreateSemanticNetworkFromNodeCandidates( [NotNull] IReadOnlyCollection <NodeCandidate> nodeCandidates, [NotNull] SessionOfExperts sessionOfExperts) { if (nodeCandidates == null) { throw new ArgumentNullException(nameof(nodeCandidates)); } if (sessionOfExperts == null) { throw new ArgumentNullException(nameof(sessionOfExperts)); } var generalVergeType = _relationTypeRepository.GetGeneralType(); var generalNodeType = _notionTypeRepository.GetGeneralType(); var root = GetOrCreateNode(sessionOfExperts.BaseNotion, generalNodeType, sessionOfExperts); _nodeRepository.AddOrUpdate(root); foreach (var nodeCandidate in nodeCandidates.Where(x => x.IsSaveAsNode)) { var node = GetOrCreateNode( nodeCandidate.Notion, _notionTypeRepository.GetById(nodeCandidate.TypeId), sessionOfExperts); _nodeRepository.AddOrUpdate(node); var straightVerge = UpdateOrCreateVerge(root, node, generalVergeType, nodeCandidate.ExpertPercent, sessionOfExperts); var reverseVerge = UpdateOrCreateVerge(node, root, generalVergeType, nodeCandidate.ExpertPercent, sessionOfExperts); _vergeRepository.AddOrUpdate(straightVerge); _vergeRepository.AddOrUpdate(reverseVerge); } }