/// <summary>
        /// Update the Atom entry specified by the id. If none exists, return null. Return the updated Atom entry. Return null if the entry does not exist.
        /// This method must be idempotent.
        /// </summary>
        /// <param name="collection">collection name</param>
        /// <param name="id">id of the entry</param>
        /// <param name="entry">Entry to put</param>
        /// <returns></returns>
        protected override SyndicationItem PutEntry(string collection, string id, System.ServiceModel.Syndication.SyndicationItem entry)
        {
            var headers = WebOperationContext.Current.IncomingRequest.Headers;

            var originalEntry = this.unitOfWork.Entries.GetById(id);

            if (originalEntry == null)
            {
                return(null);
            }

            var newEntry = entry.ConvertToModelEntry();

            try
            {
                originalEntry.Title             = newEntry.Title;
                originalEntry.Content           = newEntry.Content;
                originalEntry.StrippedDownTitle = BlogEntry.StripeDownTitle(newEntry.Title);
                originalEntry.LastUpdateDate    = newEntry.LastUpdateDate;

                originalEntry.Categories.Clear();
                foreach (var sCat in entry.Categories)
                {
                    // search if the category already exists.
                    var category = unitOfWork.Categories.GetById(BlogEntry.StripeDownTitle(sCat.Label));
                    if (category == null)
                    {   // create a new category
                        category = new Category()
                        {
                            Name = sCat.Label, Value = BlogEntry.StripeDownTitle(sCat.Label)
                        };
                    }

                    originalEntry.Categories.Add(category);
                }

                this.unitOfWork.Commit();

                return(originalEntry.ConvertToSyndicationItem(this.webOperationContext.BaseUri));
            }
            catch (Exception ex)
            {
                // TODO: add logging
                return(null);
            }
        }