private static void CreateAccount(int number, Instrument instrument) { using var uow = new NHUnitOfWork(); uow.OpenSession(_currentReadTenantIds); uow.BeginTransaction(); Console.WriteLine( $"Creating Account#: {number} under Instrument#: {instrument.Number} for Tenant ID: {_currentWriteTenantId}"); var account = new Account { AccountNumber = number, Instrument = instrument }; try { instrument.AddAccount(account); uow.Session.SaveOrUpdate(account); uow.Commit(); } catch (InvalidOperationException ex) { Console.WriteLine($"Unable to create Account: {ex.Message}"); uow.Rollback(); } }