/// <summary> /// Relates the root node with adjacent ones. /// </summary> /// <param name="node">The root node of a subtree.</param> /// <returns>The task</returns> public async Task RelatePath(NodeModel nodeModel) { var node = AutoMapper.Mapper.Map <NodeEntity>(nodeModel); var adjacentNodes = AutoMapper.Mapper.Map <List <NodeEntity> >(nodeModel.AdjacentNodes); await nodeRepository.AddOrUpdateAsync(node); await nodeRepository.AdjacentNodesIfDoNotExistAsync(nodeModel.Id, adjacentNodes); }