/**
  * Creates and fills a transaction model
  *
  * @param array $response
  * @return Transaction
  */
 private function _createTransaction(array $response)
 {
     $model = new Transaction();
     $model->setId($response['id']);
     $model->setAmount($response['amount']);
     $model->setOriginAmount($response['origin_amount']);
     $model->setStatus($response['status']);
     $model->setDescription($response['description']);
     $model->setLivemode($response['livemode']);
     $model->setRefunds($this->_handleRecursive($response['refunds'], 'refund'));
     $model->setCurrency($response['currency']);
     $model->setCreatedAt($response['created_at']);
     $model->setUpdatedAt($response['updated_at']);
     $model->setResponseCode($response['response_code']);
     $model->setShortId($response['short_id']);
     $model->setInvoices($response['invoices']);
     $model->setPayment($this->_convertResponseToModel($response['payment'], "payment"));
     $model->setClient($this->_convertResponseToModel($response['client'], "client"));
     $model->setPreauthorization($this->_convertResponseToModel($response['preauthorization'], "preauthorization"));
     $model->setFees($response['fees']);
     $model->setAppId($response['app_id']);
     if (isset($response[Transaction::RESPONSE_FIELD_SHIPPING_ADDRESS])) {
         $model->setShippingAddress($this->_convertResponseToModel($response[Transaction::RESPONSE_FIELD_SHIPPING_ADDRESS], AbstractAddress::TYPE_SHIPPING));
     }
     if (isset($response[Transaction::RESPONSE_FIELD_BILLING_ADDRESS])) {
         $model->setBillingAddress($this->_convertResponseToModel($response[Transaction::RESPONSE_FIELD_BILLING_ADDRESS], AbstractAddress::TYPE_BILLING));
     }
     if (isset($response[Transaction::RESPONSE_FIELD_ITEMS])) {
         $model->setItems($this->_handleRecursive($response[Transaction::RESPONSE_FIELD_ITEMS], 'item'));
     }
     return $model;
 }