$av = new EconomicUnit($id);
} catch (Exception $e) {
    header("Location: " . SITE);
}
$av->setEconomicUnitName(fRequest::encode('title', 'string'));
//$av->setCreatedAt(date('Y-m-d H:m:s'));
$av->setEconomicUnitStreetType(fRequest::encode('type', 'string'));
$av->setEconomicUnitLatitude(fRequest::encode('latitude', 'string'));
$av->setEconomicUnitLongitude(fRequest::encode('longitude', 'string'));
$av->setEconomicUnitDescription(fRequest::encode('description', 'string'));
$av->setEconomicUnitStreetName(fRequest::encode('street', 'string'));
$av->setEconomicUnitLocationNumber(fRequest::encode('number', 'string'));
$av->setEconomicUnitReserve(fRequest::encode('reserve', 'string'));
$av->setEconomicUnitPhone(fRequest::encode('phone', 'string'));
$av->setEconomicUnitCellphone(fRequest::encode('cellphone', 'string'));
$av->setEconomicUnitEmail(fRequest::encode('email', 'string'));
$av->setEconomicUnitCreditCard(fRequest::encode('credit_card', 'string'));
$av->setEconomicUnitFacebookPage(fRequest::encode('fb', 'string'));
$av->setEconomicUnitTwitter(fRequest::encode('tw', 'string'));
$av->setActive(fRequest::encode('status', 'integer'));
$av->setVerified(fRequest::encode('verified', 'integer'));
try {
    $av->store();
} catch (Exception $e) {
    exit("Ha ocurrido un error." . $e->getMessage());
}
$id_cat = fRequest::encode('cat', 'array');
$total_cat = count($id_cat);
fORMDatabase::retrieve()->query("DELETE FROM economic_units_has_economic_unit_categories  WHERE economic_units_economic_unit_id = {$id}");
for ($i = 0; $i < $total_cat; $i++) {
    $ts = new EconomicUnitHasCategory();