/**
   * Reserved for internal use. Parses the table operation response into a {@link TableResult} to
   * return.
   *
   * @param xmlr An <code>XMLStreamReader</code> containing the response to an insert operation.
   * @param httpStatusCode The HTTP status code returned from the operation request.
   * @param etagFromHeader The <code>String</code> containing the Etag returned with the operation
   *     response.
   * @param opContext An {@link OperationContext} object that represents the context for the current
   *     operation.
   * @return The {@link TableResult} representing the result of the operation.
   * @throws XMLStreamException if an error occurs accessing the <code>XMLStreamReader</code>.
   * @throws ParseException if an error occurs in parsing the response.
   * @throws InstantiationException if an error occurs in object construction.
   * @throws IllegalAccessException if an error occurs in reflection on an object type.
   * @throws StorageException if an error occurs in the storage operation.
   */
  protected TableResult parseResponse(
      final XMLStreamReader xmlr,
      final int httpStatusCode,
      final String etagFromHeader,
      final OperationContext opContext)
      throws XMLStreamException, ParseException, InstantiationException, IllegalAccessException,
          StorageException {
    TableResult resObj = null;
    if (this.opType == TableOperationType.INSERT) {
      // Sending null for class type and resolver will ignore parsing the return payload.
      resObj = AtomPubParser.parseSingleOpResponse(xmlr, httpStatusCode, null, null, opContext);
      resObj.updateResultObject(this.getEntity());
    } else {
      resObj = new TableResult(httpStatusCode);
      resObj.setResult(this.getEntity());

      if (this.opType != TableOperationType.DELETE) {
        this.getEntity().setEtag(etagFromHeader);
      }
    }

    return resObj;
  }