       request.error (xhr) => @error "Unable to update annotation in Readmill"
 
   _onAnnotationDeleted: (annotation) =>
-    
+    if annotation.highlightUrl
+      @client.deleteHighlight(annotation.highlightUrl).error =>
+        @error "Unable to update annotation in Readmill"
 
 utils =
   serializeQueryString: (obj, sep="&", eq="=") ->

    @error "Unable to create reading for this book"

  _onCreateHighlight: (annotation, data) ->
    annotation.highlightUrl = data.location

    # Now try and get a permalink for the comment by fetching the first
    # comment for the newly created highlight.
    @client.request(url: data.location).done (highlight) =>
      @client.request(url: highlight.comments).done (comments) ->
        annotation.commentUrl = comments[0].uri if comments.length


  createHighlight: (url, highlight, comment) ->
    @request type: "POST", url: url, data: {highlight, comment}

  deleteHighlight: (url) ->
    @request type: "DELETE", url: url

  updateComment: (url, comment) -> 
    # Need to provide a data filter to trim the re
