public void Update(string name, string newName) { try { GlobalStore.DataSets.AddBusy(name); GlobalStore.DataSets.AddBusy(newName); var dataSet = GlobalStore.DataSets.Get(name); if (dataSet == null) { throw new InvalidOperationException(); } // Apply the new alias first to check it is valid indexQuery.CreateAlias(dataSet.IndexName, newName); if (!string.IsNullOrEmpty(dataSet.AliasName) && indexQuery.IsAliasExist(dataSet.AliasName)) { indexQuery.RemoveAlias(dataSet.IndexName, dataSet.AliasName); } GlobalStore.DataSets.Rename(name, newName); } finally { GlobalStore.DataSets.RemoveBusy(name); GlobalStore.DataSets.RemoveBusy(newName); } }