private XElement getJobDataMap(XNamespace ns, JobDataMap jobDataMap) { XElement map = new XElement(ns + "job-data-map"); foreach (var key in jobDataMap.GetKeys()) { map.Add(new XElement(ns + "entry" , new XElement(ns + "key", key) , new XElement(ns + "value", jobDataMap[key]) ) ); } return map; }