public void Add(Instrument instrument, bool save = true) { if (Contains(instrument.Symbol)) { throw new ArgumentException($"Instrument with the same symbol is already present in the framework : {instrument.Symbol}"); } var i = this.deletedInstruments.Get(instrument.Symbol); if (i != null) { Console.WriteLine($"InstrumentManager::Add Using deleted instrument id = {i.Id} for symbol {instrument.Symbol}"); instrument.Id = i.Id; this.deletedInstruments.Remove(i); } else { instrument.Id = this.counter++; } Instruments.Add(instrument); if (instrument.Framework == null) { instrument.Init(this.framework); } if (save) { instrument.Loaded = true; Save(instrument); } this.framework.EventServer.OnInstrumentAdded(instrument); }