/**
  * Formats the Neo4j Response.
  *
  * @param $response
  *
  * @return Response
  */
 public function format($response)
 {
     $this->isNew = false;
     $responseObject = new Response();
     $responseObject->setRawResponse($response);
     if ($responseObject->containsResults()) {
         $this->extractResults($response);
         $this->prepareResultSet();
         $this->prepareNodesByLabels();
         $this->prepareRelationshipsByType();
         $this->processIdentification($response);
     }
     if ($responseObject->containsRows()) {
         $rows = $this->formatRows($response);
         $responseObject->setRows($rows);
         if ($responseObject->containsResults()) {
             foreach ($responseObject->geRows() as $k => $v) {
                 if (!$this->result->hasIdentifier($k)) {
                     $this->result->addIdentifierValue($k, $v);
                 }
             }
         }
     }
     if (is_array($responseObject->geRows())) {
         $this->processTableFormat($responseObject->geRows());
     }
     $responseObject->setResult($this->result);
     $this->reset();
     return $responseObject;
 }