public string toJson()
{
Dictionary<string, string> myDict = new Dictionary<string, string>();
// mandatory fields
myDict.Add("api_key", this.apiKey);
myDict.Add("creator_email", this.creatorEmail);
myDict.Add("advocate_email", this.advocateEmail);
myDict.Add("case_number", this.caseNumber);
myDict.Add("case_type_id", this.caseType);
myDict.Add("court_id", this.courtId);
myDict.Add("offence_id", "36");
myDict.Add("first_day_of_trial", convertDate(this.trialStartDate));
myDict.Add("estimated_trial_length", Convert.ToString(this.estimatedTrialLength));
myDict.Add("actual_trial_length", Convert.ToString(this.actualTrialLength));
myDict.Add("trial_concluded_at", convertDate(this.endTrialDate));
myDict.Add("advocate_category", this.advocateCategory);
// optional fields
// - only send them if they have a value
if (!String.IsNullOrEmpty(this.cmsNumber)) myDict.Add("cms_number", this.cmsNumber);
if (!String.IsNullOrEmpty(this.additionalInformation)) myDict.Add("additional_information", this.additionalInformation);
if (!String.IsNullOrEmpty(this.applyVat.ToString())) myDict.Add("apply_vat", Convert.ToString(this.applyVat));
if (this.trialFixedNoticeAt != new DateTime()) myDict.Add("trial_fixed_notice_at", convertDate(this.trialFixedNoticeAt));
if (this.trialFixedAt != new DateTime()) myDict.Add("trial_fixed_at", convertDate(this.trialFixedAt));
if(this.trialCrackedAt != new DateTime()) myDict.Add("trial_cracked_at", convertDate(this.trialCrackedAt));
if (!String.IsNullOrEmpty(this.trialCrackedAtThird)) myDict.Add("trial_cracked_at_third", this.trialCrackedAtThird);
//don't think the IsoDateTimeConverter has any impact here
return JsonConvert.SerializeObject(myDict, new IsoDateTimeConverter());
}