public static bool SetNode(ref XmlNode xml, string xpath, AttachmentCollection objCollection) { XmlNode node = XmlLoader.GetNode(xml, xpath); if ((node == null) || (objCollection == null)) { return(false); } StringBuilder builder = new StringBuilder(); foreach (Attachment attachment in objCollection) { try { builder.Append(AttachmentNode(attachment)); continue; } catch (Exception exception) { Console.WriteLine(exception.ToString()); continue; } } node.InnerXml = builder.ToString(); return(true); }