public static int ListsInterestGroupingAdd(SqlString apikey, SqlString list_id, SqlString name, SqlString type, SqlString groupsCSV) { try { MailChimpManager mc = new MailChimpManager(apikey.ToString()); string[] groups = groupsCSV.ToString().Split(','); InterestGroupingResult result = mc.AddListInterestGrouping(list_id.ToString(), name.ToString(), type.ToString(), new List <string>(groups)); SqlDataRecord record = new SqlDataRecord(IdResultsMetaData); record.SetInt32(0, result.id); SqlContext.Pipe.Send(record); } catch (Exception ex) { SqlContext.Pipe.Send(ex.Message); return(1); } return(0); }