void SetDataInternal(XtraReport report, string url, bool isNewOne) { if (!isNewOne && !Reports.ContainsKey(url)) { throw new FaultException(new FaultReason(string.Format("Could not find report '{0}'.", url)), new FaultCode("Server"), "SetData"); } using (var stream = new MemoryStream()) { report.SaveLayoutToXml(stream); var reportLayout = stream.ToArray(); var newReportDetails = new ReportDetails { DisplayName = url, Layout = reportLayout }; Reports.AddOrUpdate(url, newReportDetails, (currentUrl, existingReport) => { existingReport.Layout = reportLayout; return existingReport; }); } }