private static SyndicationFeed GetFeed(Stream stream, SyndicationFeedFormatter formatter)
        {
            Contract.Requires(stream != null);
            Contract.Requires(formatter != null);
            Contract.Ensures(Contract.Result <SyndicationFeed>() != null);

            using (stream)
                using (var reader = XmlReader.Create(stream))
                {
                    formatter.ReadFrom(reader);
                }

            var feed = formatter.Feed;

            Contract.Assume(feed != null);

            return(feed);
        }
        /// <summary>Reads a SyndicationFeed object from the specified XmlReader.</summary>
        /// <param name='formatter'>Formatter to use when reading content.</param>
        /// <param name='reader'>Read to read feed from.</param>
        /// <returns>A new SyndicationFeed instance.</returns>
        private static SyndicationFeed ReadSyndicationFeed(SyndicationFeedFormatter formatter, XmlReader reader)
        {
            Debug.Assert(formatter != null, "formatter != null");
            Debug.Assert(reader != null, "reader != null");

            try
            {
                formatter.ReadFrom(reader);
            }
            catch (XmlException exception)
            {
                throw DataServiceException.CreateBadRequestError(Strings.Syndication_ErrorReadingFeed(exception.Message), exception);
            }

            Debug.Assert(formatter.Feed != null, "formatter.Feed != null");
            return formatter.Feed;
        }
    private static SyndicationFeed GetFeed(Stream stream, SyndicationFeedFormatter formatter)
    {
      Contract.Requires(stream != null);
      Contract.Requires(formatter != null);
      Contract.Ensures(Contract.Result<SyndicationFeed>() != null);

      using (stream)
      using (var reader = XmlReader.Create(stream))
      {
        formatter.ReadFrom(reader);
      }

      var feed = formatter.Feed;

      Contract.Assume(feed != null);

      return feed;
    }