public void AddSerie(string DimId, string Value, string KeyPosition, bool isFrequency) { bool Exists = false; foreach (var item in this.JsonStruct.Series) { if (item.Id == DimId) { Exists = true; SDMXJsonValue Val = new SDMXJsonValue(); Val.Id = Value; if (!(item.ExistValue(Val))) { if (item.Values.Count > 0) { Val.Index = item.GetLastIndex(Val) + 1; } else { Val.Index = item.GetLastIndex(Val); } item.Values.Add(Val); break; } } } if (!Exists) { SDMXJsonDimension Serie = new SDMXJsonDimension(); Serie.Id = DimId; Serie.KeyPosition = KeyPosition; if (isFrequency) { Serie.Role = "frequency"; } this.JsonStruct.Series.Add(Serie); AddSerie(DimId, Value, KeyPosition, isFrequency); } }