public static function requestSaveTamanho()
 {
     try {
         $id_empreendimento = $_POST['id_empreendimento'];
         $tamanho = $_POST['tamanho'];
         $ReferenciaIntegracaoDao = new ReferenciaIntegracaoDao();
         $ReferenciaIntegracaoTO = new ReferenciaIntegracaoTO();
         $PrestaShopDao = new PrestaShopDao($id_empreendimento);
         $TamanhoDao = new TamanhoDao();
         $ReferenciaIntegracaoTO = new ReferenciaIntegracaoTO();
         $ReferenciaIntegracaoTO->sistema_integrado = 'PrestaShop';
         $ReferenciaIntegracaoTO->tabela = 'tbl_tamanho';
         $ReferenciaIntegracaoTO->id_item = null;
         $ReferenciaIntegracaoTO->id_item_referencia = $tamanho['id_attribute'];
         $ReferenciaIntegracaoTO->tipo = 'tamanho';
         $ReferenciaIntegracaoTO->id_empreendimento = $id_empreendimento;
         $referencia = $ReferenciaIntegracaoDao->refExists($ReferenciaIntegracaoTO, true);
         if ($referencia) {
             $obj = new stdClass();
             $obj->nome_tamanho = $tamanho['name'];
             if (!$TamanhoDao->updateTamanho($obj, 'id=' . $referencia['id_item'])) {
                 throw new Exception('Erro ao atualizar Tamanho', 1);
             }
         } else {
             $last_id = $TamanhoDao->saveTamanho($tamanho['name'], array($id_empreendimento), true);
             if (!is_numeric($last_id)) {
                 throw new Exception('Erro ao cadastrar Tamanho', 1);
             }
             $ReferenciaIntegracaoTO->id_item = $last_id;
             if (!$ReferenciaIntegracaoDao->save($ReferenciaIntegracaoTO)) {
                 throw new Exception('Erro ao criar referencia no sistema', 1);
             }
         }
     } catch (Exception $e) {
         $log = new KLogger("logs/logErrorPrestaShop.txt", KLogger::DEBUG);
         $log->LogError($e->getMessage() . '- file:' . $e->getFile() . ' - line:' . $e->getLine());
         $log->LogDebug(json_encode($_POST));
         $log->LogJunp();
         Flight::halt(500, $e->getMessage());
     }
 }