public string AddOrUpdateItem(TData item, ItemInsertMode mode) { string idValue = myType.GetProperty(idPropertyName).GetValue(item) as string; if (idValue == null) { idValue = myType.GetProperty(idPropertyName).GetValue(item).ToString(); } var res = this.Api.ApiV2DatasetyDatasetItemUpdate(this.DatasetId, idValue, item, mode.ToString()); return(res.Id); }