public void OnExport() { List <UInt32> usedBranches = new List <uint>(); List <ActionBranch> list = new List <ActionBranch>(); foreach (ActionBranch ab in this) { List <ActionBranch> l = ab.OnExport(this, usedBranches); if (l != null && l.Count > 0) { list.AddRange(l); } } BranchList list2 = new BranchList(this._actsHolder); foreach (ActionBranch ab in list) { if (list2.GetBranchById(ab.BranchId) == null) { if (list2.GetBranchById(ab.FirstActionId) == null) { list2.Add(ab); } else { DesignUtil.WriteToOutputWindow("Duplicated first branch {0}", ab.FirstActionId); } } else { DesignUtil.WriteToOutputWindow("Duplicated branch {0}", ab.BranchId); } } foreach (ActionBranch ab in list2) { if (GetBranchById(ab.BranchId) == null) { this.Add(ab); } } }