/// <summary>
        /// Get a utility photo from a Picasa photo entry
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private Picasa.Photo GetUtilityPicasaPhotoFromPhotoEntry(SyndicationItem item)
        {
            Picasa.Photo p = new Picasa.Photo();
            Dictionary<XmlQualifiedName, string> aes = item.AttributeExtensions;
            XmlQualifiedName qn = new XmlQualifiedName(GoogleUtilityConstants.GOOGLE_ETAG_SCHEMA);
            //p.eTag = aes[qn];
            foreach (var a in item.Authors)
            {
                GoogleUtility.Picasa.Author gpa = new Picasa.Author();
                gpa.Name = a.Name;
                gpa.URI = a.Uri;
                gpa.Email = a.Email;
                gpa.AttributeExtensions = a.AttributeExtensions;
                gpa.ElementExtensions = a.ElementExtensions;
                p.Authors.Add(gpa);
            }

            p.FullEntryPath = item.Id;
            p.Title = item.Title.Text;
            p.Summary = item.Summary.Text;
            p.PublishDate = item.PublishDate.DateTime;
            p.LastUpdatedTime = item.LastUpdatedTime.DateTime;
            p.Links = new List<Picasa.Link>();
            foreach (var l in item.Links)
            {
                Picasa.Link pl = new Picasa.Link();
                pl.HREF = l.Title;
                pl.Rel = l.RelationshipType;
                pl.Type = l.MediaType;
                p.Links.Add(pl);
            }

            foreach (var ext in item.ElementExtensions)
            {
                switch (ext.OuterName)
                {
                    case "edited":
                        p.Edited = Convert.ToDateTime(ext.GetReader().ReadInnerXml());
                        break;
                    case "id":
                        p.ID = ext.GetReader().ReadInnerXml();
                        break;
                    case "albumid":
                        p.AlbumID = ext.GetReader().ReadInnerXml();
                        break;
                    case "access":
                        p.Access = ext.GetReader().ReadInnerXml();
                        break;
                    case "width":
                        p.Width = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "height":
                        p.Height = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "size":
                        p.Size = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "checksum":
                        p.checksum = ext.GetReader().ReadInnerXml();
                        break;
                    case "timestamp":
                        p.timestamp = ext.GetReader().ReadInnerXml();
                        break;
                    case "imageVersion":
                        p.ImageVersion = ext.GetReader().ReadInnerXml();
                        break;
                    case "commentingEnabled":
                        p.CommentingEnabled = Convert.ToBoolean(ext.GetReader().ReadInnerXml());
                        break;
                    case "commentCount":
                        p.CommentCount = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "license":
                        p.license = ext.GetReader().ReadInnerXml();
                        break;
                    case "viewCount":
                        p.ViewCount = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "tags":
                        p.Tags = ext.GetReader().ReadInnerXml();
                        break;
                    case "group":
                        string pmgXML = ext.GetReader().ReadInnerXml();
                        pmgXML = @"<group>" + pmgXML + @"</group>";
                        XmlReader xmlr = XmlReader.Create(new StringReader(pmgXML));
                        XDocument xDoc = XDocument.Load(xmlr);
                        GoogleUtility.Picasa.PhotoMediaGroup pmg = new Picasa.PhotoMediaGroup();
                        pmg.Thumbnails = new List<Picasa.PhotoMediaThumbnail>();

                        XElement groupElement = xDoc.Element("group");
                        IEnumerable<XElement> elms = groupElement.Elements();
                        foreach (var e in elms)
                        {
                            switch (e.Name.LocalName)
                            {
                                case "content":
                                    GoogleUtility.Picasa.PhotoMediaContent content = new Picasa.PhotoMediaContent();
                                    content.ContentType = e.Attribute("type").Value;
                                    content.Height = Convert.ToInt32(e.Attribute("height").Value);
                                    content.Medium = e.Attribute("medium").Value;
                                    content.URL = e.Attribute("url").Value;
                                    content.Width = Convert.ToInt32(e.Attribute("width").Value);
                                    pmg.Content = content;
                                    break;
                                case "credit":
                                    pmg.Credit = e.Value;
                                    break;
                                case "description":
                                    pmg.Description = e.Value;
                                    break;
                                case "keywords":
                                    pmg.Keywords = e.Value;
                                    break;
                                case "title":
                                    pmg.Title = e.Value;
                                    break;
                                case "thumbnail":
                                    GoogleUtility.Picasa.PhotoMediaThumbnail t = new Picasa.PhotoMediaThumbnail();
                                    t.Height = Convert.ToInt32(e.Attribute("height").Value);
                                    t.URL = e.Attribute("url").Value;
                                    t.Width = Convert.ToInt32(e.Attribute("width").Value);
                                    pmg.Thumbnails.Add(t);
                                    break;
                                default:
                                    break;
                            }
                        }
                        p.Group = pmg;
                        break;
                    default:
                        break;
                }
            }
            return p;
        }
        /// <summary>
        /// Post a photo
        /// </summary>
        /// <param name="p">The Photo Entry information to post</param>
        /// <param name="albumID">The album to post to</param>
        /// <param name="access_token">The user access token</param>
        /// <returns></returns>
        public string PostPhoto(Picasa.PhotoEntryPost p, string albumID, string access_token)
        {
            FileInfo fi = new FileInfo(p.fileName);
            Requestor.ContentType contentType = Requestor.ContentType.IMAGE_JPG;
            switch (fi.Extension)
            {
                case ".jpg":
                    contentType = Requestor.ContentType.IMAGE_JPG;
                    break;
                case ".bmp":
                    contentType = Requestor.ContentType.IMAGE_BMP;
                    break;
                case ".png":
                    contentType = Requestor.ContentType.IMAGE_PNG;
                    break;
                case ".gif":
                    contentType = Requestor.ContentType.IMAGE_GIF;
                    break;
            }

            GoogleTCPRequestor tcpr = new GoogleTCPRequestor(Requestor.Operation.POST
                                                            , Requestor.HTTPFormat.FORMAT_1_1
                                                            , contentType
                                                            , GoogleUtilityConstants.GOOGLE_PICASA_HOST
                                                            , string.Format("{0}{1}"
                                                                            , GoogleUtilityConstants.PICASA_FEED_BASE_URI_NO_HTTPS
                                                                            , string.Format(GoogleUtilityConstants.PICASA_ALBUMID_URI, albumID))
                                                            , p.toXmlPostString()
                                                            , access_token
                                                            , true);

            string response = tcpr.SubmitAltRequest(true, Requestor.ResponseTerminatorAction.ENTRY_TERMINATOR, p.payload, contentType);
            SyndicationItem si = getItemFromResponse(response);

            string retString = "";
            if (si != null)
            {
                foreach (var link in si.Links)
                {
                    Picasa.Link l = new Picasa.Link();
                    l.Type = link.MediaType;
                    l.Rel = link.RelationshipType;
                    l.HREF = link.Uri.AbsoluteUri;
                    if (l.Rel.ToLower().Contains("feed"))
                    {
                        retString = l.HREF;
                    }
                    System.Diagnostics.Debug.WriteLine(l.HREF);

                }
            }
            return retString;
        }
        /// <summary>
        /// Get the utility Album object from an album entry.
        /// </summary>
        /// <param name="albumEntry">The syndication item album entry.</param>
        /// <returns>A utility album formatted as a utility picasa album object</returns>
        private GoogleUtility.Picasa.Album GetUtilityAlbumFromAlbumEntry(SyndicationItem albumEntry)
        {
            //each 'item' is a new album to handle, so put it in the feed
            Picasa.Album a = new Picasa.Album();
            if (albumEntry == null) return null;

            Dictionary<XmlQualifiedName, string> aes = albumEntry.AttributeExtensions;
            XmlQualifiedName qn = new XmlQualifiedName(GoogleUtilityConstants.GOOGLE_ETAG_SCHEMA);
            //a.eTag = aes[qn];
            a.FullPath = albumEntry.Id;
            a.Title = albumEntry.Title.Text;
            a.Summary = albumEntry.Summary.Text;
            a.Published = albumEntry.PublishDate.DateTime;
            a.Updated = albumEntry.LastUpdatedTime.DateTime;
            a.Links = new List<Picasa.Link>();
            foreach (var l in albumEntry.Links)
            {
                Picasa.Link pl = new Picasa.Link();
                pl.HREF = l.Title;
                pl.Rel = l.RelationshipType;
                pl.Type = l.MediaType;
                a.Links.Add(pl);
            }
            a.Categories = new List<Picasa.Category>();
            foreach (var c in albumEntry.Categories)
            {
                Picasa.Category pc = new Picasa.Category();
                pc.Label = c.Label;
                pc.Name = c.Name;
                pc.Scheme = c.Scheme;
                a.Categories.Add(pc);
            }

            foreach (var ext in albumEntry.ElementExtensions)
            {
                switch (ext.OuterName)
                {
                    case "edited":
                        a.Edited = Convert.ToDateTime(ext.GetReader().ReadInnerXml());
                        break;
                    case "id":
                        a.ID = ext.GetReader().ReadInnerXml();
                        break;
                    case "name":
                        a.Name = ext.GetReader().ReadInnerXml();
                        break;
                    case "location":
                        a.Location = ext.GetReader().ReadInnerXml();
                        break;
                    case "timestamp":
                        a.TimeStamp = ext.GetReader().ReadInnerXml();
                        break;
                    case "access":
                        a.AccessRights = ext.GetReader().ReadInnerXml();
                        break;
                    case "numphotos":
                        a.NumberOfPhotos = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "numphotosremaining":
                        a.NumberOfPhotosRemaining = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "bytesUsed":
                        a.BytesUsed = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    case "user":
                        a.User = ext.GetReader().ReadInnerXml();
                        break;
                    case "nickname":
                        a.NickName = ext.GetReader().ReadInnerXml();
                        break;
                    case "group":
                        a.Group = ext.GetReader().ReadInnerXml();
                        break;
                    case "where":
                        a.Where = ext.GetReader().ReadInnerXml();
                        break;
                    case "commentingEnabled":
                        a.CommentingEnabled = Convert.ToBoolean(ext.GetReader().ReadInnerXml());
                        break;
                    case "commentCount":
                        a.CommentCount = Convert.ToInt32(ext.GetReader().ReadInnerXml());
                        break;
                    default:
                        break;
                }
            }
            return a;
        }