private void Update(string assetPairId, Func <AssetPairExtPriceSettings, AssetPairExtPriceSettings> changeFunc, string reason) { ImmutableSortedDictionary <string, ExchangeExtPriceSettings> oldExchanges = null; ImmutableSortedDictionary <string, ExchangeExtPriceSettings> newExchanges = null; _settingsRootService.Update(assetPairId, old => { oldExchanges = old.ExtPriceSettings.Exchanges; var newSettings = changeFunc(old.ExtPriceSettings); newExchanges = newSettings.Exchanges; return(new AssetPairSettings(old.QuotesSourceType, newSettings, old.CrossRateCalcInfo, old.AggregateOrderbookSettings)); }); oldExchanges.RequiredNotNull(nameof(oldExchanges)); newExchanges.RequiredNotNull(nameof(newExchanges)); ExchangesTemporarilyDisabledChanged(assetPairId, oldExchanges, newExchanges, reason); CanPerformHedgingChanged(assetPairId, oldExchanges, newExchanges, reason); }