/// <summary>
 /// Updates the comment.
 /// </summary>
 /// <param name="comment">The comment.</param>
 /// <returns></returns>
 public bool UpdateComment(Comment comment)
 {
     return this.ServiceAdapter.UpdateComment(comment);
 }
 /// <summary>
 /// Deletes the comment.
 /// </summary>
 /// <param name="comment">The comment.</param>
 /// <returns></returns>
 public bool DeleteComment(Comment comment)
 {
     return this.ServiceAdapter.DeleteComment(comment);
 }
 /// <summary>
 /// Creates the and map comment.
 /// </summary>
 /// <param name="asset">The asset.</param>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 protected Comment CreateAndMapComment(Asset asset, XmlNode node)
 {
     Comment c = new Comment();
     this.MapComment(asset, c, node);
     return c;
 }
        /// <summary>
        /// Updates the comment.
        /// </summary>
        /// <param name="comment">The comment.</param>
        /// <returns></returns>
        public bool UpdateComment(Comment comment)
        {
            if (comment == null)
                throw new ArgumentNullException("comment", "The given comment can't be null");

            bool updated = false;
            Asset asset = comment.Asset;
            Drop drop = asset.Drop;

            NameValueCollection parameters = new NameValueCollection();

            string token = drop.AdminToken;
            parameters.Add("token", token);
            parameters.Add("contents", comment.Contents);

            HttpWebRequest request = this.CreatePutRequest(this.CreateCommentUrl(drop.Name, asset.Name, comment.Id), parameters);
            CompleteRequest(request, delegate(HttpWebResponse response)
            {
                ReadResponse(response, delegate(XmlDocument doc)
                {
                    XmlNodeList nodes = doc.SelectNodes("/comment");

                    this.MapComment(asset, comment, nodes[0]);
                    updated = true;
                });
            });

            return updated;
        }
        /// <summary>
        /// Deletes the comment.
        /// </summary>
        /// <param name="comment">The comment.</param>
        /// <returns></returns>
        public bool DeleteComment(Comment comment)
        {
            bool destroyed = false;
            Asset asset = comment.Asset;
            Drop drop = asset.Drop;

            NameValueCollection parameters = new NameValueCollection();

            string token = drop.AdminToken;
            parameters.Add("token", token);

            HttpWebRequest request = this.CreateDeleteRequest(this.CreateCommentUrl(drop.Name, asset.Name, comment.Id), parameters);
            CompleteRequest(request, (HttpWebResponse response) => { destroyed = true; });

            return destroyed;
        }
 /// <summary>
 /// Maps the comment.
 /// </summary>
 /// <param name="asset">The asset.</param>
 /// <param name="c">The c.</param>
 /// <param name="node">The node.</param>
 protected void MapComment(Asset asset, Comment c, XmlNode node)
 {
     c.CreatedAt = this.ExtractDateTime(this.ExtractInnerText(node, "created_at"));
     c.Contents = this.ExtractInnerText(node, "contents");
     c.Id = this.ExtractInt(node, "id");
     c.Asset = asset;
 }