internal static ReadOnlyCollection <AttachmentLink> InternalItemsToICal(string calendarName, IList <Item> items, ReadOnlyCollection <AttachmentLink> existingAttachmentLinks, OutboundAddressCache addressCache, bool suppressExceptionAndAttachmentDemotion, Stream stream, List <LocalizedString> errorStream, string charsetName, OutboundConversionOptions outboundConversionOptions)
        {
            Util.ThrowOnNullArgument(items, "items");
            if (!suppressExceptionAndAttachmentDemotion && items.Count != 1)
            {
                throw new ArgumentException("Non suppressExceptionAndAttachmentDemotion mode should have one and only one item to demote");
            }
            Charset          charset          = Charset.GetCharset(charsetName);
            CalendarDocument calendarDocument = new CalendarDocument();

            using (CalendarWriter calendarWriter = new CalendarWriter(new StreamWrapper(stream, false), charset.Name))
            {
                ICalOutboundContext outboundContext = new ICalOutboundContext(charset, errorStream, addressCache, outboundConversionOptions, calendarWriter, calendarName, existingAttachmentLinks, suppressExceptionAndAttachmentDemotion);
                calendarDocument.Demote(outboundContext, items);
            }
            return(existingAttachmentLinks);
        }
 private void Demote(ICalOutboundContext outboundContext, IList <Item> items)
 {
     this.vCalendar = new VCalendar(outboundContext);
     this.vCalendar.Demote(items);
 }