public TaxonomyTree(ILog log, TaxonRepository repo, RelationService relationSrv, int rootId) { this.log = log; this.rootId = rootId; this.repo = repo; this.relationSrv = relationSrv; rootEntity = repo.Get(rootId); if (rootEntity == null) { if (rootId == 1) { rootEntity = new TaxonEntity() { Name = "Root", Description = "Root node - parent of all taxon entries" }; repo.Save(rootEntity); } else { throw new Exception("Root node is not found"); } } rootNode = new TaxonomyNode(this, rootEntity); }