def save_document(document, validate = true, retries = 0, &block)
      begin
        block.call document if block
        save_document_without_conflict_handling(document, validate)
      rescue CouchRest::Conflict => e
        if block
          handle_write_conflict document, validate, retries, &block
        else
          raise CouchPotato::Conflict.new
        end
      end
    end
def save_document(document, validate = true, retries = 0, &block)
      begin
        block.call document if block
        save_document_without_conflict_handling(document, validate)
      rescue CouchRest::Conflict => e
        if block
          handle_write_conflict document, validate, retries, &block
        else
          raise CouchPotato::Conflict.new
        end
      end
    end
saves a document. returns true on success, false on failure.
 if passed a block will:
 * yield the object to be saved to the block and run if once before saving
 * on conflict: reload the document, run the block again and retry saving