public void AddAction(TriggerAction triggeraction) { if (Actions.Count == 9 && !HasCreatedChild) { HasCreatedChild = true; Child = new Trigger(); Execute(Child); Child.AddAction(triggeraction); } else if (Actions.Count == 10) { if (Child == null) { throw new Exception("Child was not set despite action count is 10"); } Child.AddAction(triggeraction); } else { Actions.Add(triggeraction); } }