public Transaction(Machine machine) { this.id = NextId(); NextId(); // for out of transaction get,set if (machine == null) throw new InvalidOperationException("Transaction should run in a Machine"); this.machine = machine; machine.RegisterTransaction(this); }