private CustomerBrokerClose getCustomerBrokerCloseFromRecord(DatabaseTableRecord record)
      throws InvalidParameterException {

    UUID transactionId =
        record.getUUIDValue(
            CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                .CUSTOMER_BROKER_CLOSE_TRANSACTION_ID_COLUMN_NAME);
    UUID negotiationId =
        record.getUUIDValue(
            CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                .CUSTOMER_BROKER_CLOSE_NEGOTIATION_ID_COLUMN_NAME);
    String publicKeyBroker =
        record.getStringValue(
            CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                .CUSTOMER_BROKER_CLOSE_PUBLIC_KEY_BROKER_COLUMN_NAME);
    String publicKeyCustomer =
        record.getStringValue(
            CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                .CUSTOMER_BROKER_CLOSE_PUBLIC_KEY_CUSTOMER_COLUMN_NAME);
    NegotiationTransactionStatus status =
        NegotiationTransactionStatus.getByCode(
            record.getStringValue(
                CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                    .CUSTOMER_BROKER_CLOSE_STATUS_COLUMN_NAME));
    NegotiationType negotiationType =
        NegotiationType.getByCode(
            record.getStringValue(
                CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                    .CUSTOMER_BROKER_CLOSE_NEGOTIATION_TYPE_COLUMN_NAME));
    String negotiationXML =
        record.getStringValue(
            CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                .CUSTOMER_BROKER_CLOSE_NEGOTIATION_XML_COLUMN_NAME);
    long timestamp =
        record.getLongValue(
            CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                .CUSTOMER_BROKER_CLOSE_TIMESTAMP_COLUMN_NAME);

    return new CustomerBrokerCloseImpl(
        transactionId,
        negotiationId,
        publicKeyBroker,
        publicKeyCustomer,
        status,
        negotiationType,
        negotiationXML,
        timestamp);
  }
  // UPDATE STATUS NEW NEGOTIATION TRANSACTION
  public void updateStatusRegisterCustomerBrokerCloseNegotiationTranasction(
      UUID transactionId, NegotiationTransactionStatus statusTransaction)
      throws CantRegisterCustomerBrokerCloseNegotiationTransactionException {
    try {
      if (!transactionExists(transactionId))
        throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException(
            "Cant Update Status customer broker close Negotiation Transaction, not exists.",
            "customer broker close Negotiation Transaction, Update State",
            "Cant Update State customer broker close Negotiation Transaction, not exists");

      DatabaseTable table =
          this.database.getTable(
              CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                  .CUSTOMER_BROKER_CLOSE_TABLE_NAME);
      table.addUUIDFilter(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_TRANSACTION_ID_COLUMN_NAME,
          transactionId,
          DatabaseFilterType.EQUAL);
      DatabaseTableRecord record = table.getEmptyRecord();
      record.setStringValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_STATUS_COLUMN_NAME,
          statusTransaction.getCode());
      table.updateRecord(record);

      System.out.print(
          "\n\n**** 8) MOCK NEGOTIATION TRANSACTION - CUSTOMER BROKER CLOSE - DAO - UPDATE STATUS NEGOTIATION STATUS : "
              + NegotiationTransactionStatus.SENDING_NEGOTIATION.getCode()
              + " ****\n");
    } catch (CantUpdateRecordException e) {
      throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException(
          e.getMessage(),
          e,
          "customer broker close Negotiation Transaction, Update State",
          "Cant Update State customer broker close Negotiation Transaction, update database problems.");
    } catch (Exception e) {
      throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException(
          e.getMessage(),
          FermatException.wrapException(e),
          "customer broker close Negotiation Transaction, Update State",
          "Cant Update State customer broker close Negotiation Transaction, unknown failure.");
    }
  }
  // UPDATE STATUS NEW NEGOTIATION TRANSACTION
  public void updateStatusRegisterCustomerBrokerNewNegotiationTranasction(
      UUID transactionId, NegotiationTransactionStatus statusTransaction)
      throws CantRegisterCustomerBrokerNewNegotiationTransactionException {
    try {
      if (!transactionExists(transactionId))
        throw new CantRegisterCustomerBrokerNewNegotiationTransactionException(
            "Cant Update Status Customer Broker New Negotiation Transaction, not exists.",
            "Customer Broker New Negotiation Transaction, Update State",
            "Cant Update State Customer Broker New Negotiation Transaction, not exists");

      DatabaseTable table =
          this.database.getTable(
              CustomerBrokerNewNegotiationTransactionDatabaseConstants
                  .CUSTOMER_BROKER_NEW_TABLE_NAME);
      table.addUUIDFilter(
          CustomerBrokerNewNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_NEW_TRANSACTION_ID_COLUMN_NAME,
          transactionId,
          DatabaseFilterType.EQUAL);
      DatabaseTableRecord record = table.getEmptyRecord();
      record.setStringValue(
          CustomerBrokerNewNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_NEW_STATUS_TRANSACTION_COLUMN_NAME,
          statusTransaction.getCode());
      table.updateRecord(record);

    } catch (CantUpdateRecordException e) {
      throw new CantRegisterCustomerBrokerNewNegotiationTransactionException(
          e.getMessage(),
          e,
          "Customer Broker New Negotiation Transaction, Update State",
          "Cant Update State Customer Broker New Negotiation Transaction, update database problems.");
    } catch (Exception e) {
      throw new CantRegisterCustomerBrokerNewNegotiationTransactionException(
          e.getMessage(),
          FermatException.wrapException(e),
          "Customer Broker New Negotiation Transaction, Update State",
          "Cant Update State Customer Broker New Negotiation Transaction, unknown failure.");
    }
  }
  // CREATE SEND NEW NEGOTIATION TRANSACTION
  public void createCustomerBrokerCloseNegotiationTransaction(
      UUID transactionId,
      Negotiation negotiation,
      NegotiationType negotiationType,
      NegotiationTransactionStatus statusTransaction)
      throws CantRegisterCustomerBrokerCloseNegotiationTransactionException {

    Date time = new Date();
    long timestamp = time.getTime();
    String negotiationXML = XMLParser.parseObject(negotiation);

    try {

      DatabaseTable table =
          this.database.getTable(
              CustomerBrokerCloseNegotiationTransactionDatabaseConstants
                  .CUSTOMER_BROKER_CLOSE_TABLE_NAME);
      DatabaseTableRecord record = table.getEmptyRecord();

      record.setUUIDValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_TRANSACTION_ID_COLUMN_NAME,
          transactionId);
      record.setUUIDValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_NEGOTIATION_ID_COLUMN_NAME,
          negotiation.getNegotiationId());
      record.setStringValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_PUBLIC_KEY_BROKER_COLUMN_NAME,
          negotiation.getBrokerPublicKey());
      record.setStringValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_PUBLIC_KEY_CUSTOMER_COLUMN_NAME,
          negotiation.getCustomerPublicKey());
      record.setStringValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_STATUS_COLUMN_NAME,
          statusTransaction.getCode());
      record.setStringValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_NEGOTIATION_TYPE_COLUMN_NAME,
          negotiationType.getCode());
      record.setStringValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_NEGOTIATION_XML_COLUMN_NAME,
          negotiationXML);
      record.setLongValue(
          CustomerBrokerCloseNegotiationTransactionDatabaseConstants
              .CUSTOMER_BROKER_CLOSE_TIMESTAMP_COLUMN_NAME,
          timestamp);

      table.insertRecord(record);

      if (statusTransaction.getCode()
          == NegotiationTransactionStatus.PENDING_SUBMIT_CONFIRM.getCode()) {
        System.out.print(
            "\n\n**** 22) MOCK NEGOTIATION TRANSACTION - CUSTOMER BROKER CLOSE - DAO. CONFIRM negotiationType: "
                + negotiationType.getCode()
                + " transactionId: "
                + transactionId
                + " ****\n");
      } else {
        System.out.print(
            "\n\n**** 4) MOCK NEGOTIATION TRANSACTION - CUSTOMER BROKER CLOSE - DAO. NEGOTIATION negotiationType: "
                + negotiationType.getCode()
                + "transactionId: "
                + transactionId
                + " ****\n");
      }

    } catch (CantInsertRecordException e) {
      throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException(
          e.getMessage(),
          e,
          "customer broker close Negotiation Transaction",
          "Cant create new customer broker close Negotiation Transaction, insert database problems.");
    } catch (Exception e) {
      throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException(
          e.getMessage(),
          FermatException.wrapException(e),
          "customer broker close Negotiation Transaction",
          "Cant create new customer broker close Negotiation Transaction, unknown failure.");
    }
  }