function change_htype($conn, $data)
{
    $uuid = $data['id'];
    list($os, $dtype) = explode("_", $data['type']);
    // Type
    ossim_valid($uuid, OSS_HEX, 'illegal:' . _("ID"));
    ossim_valid($os, OSS_NULLABLE, OSS_ALPHA, 'illegal:' . _("OS"));
    ossim_valid($dtype, OSS_NULLABLE, OSS_ALPHA, 'illegal:' . _("Device Type"));
    check_ossim_error();
    if (empty($dtype) && empty($os)) {
        Asset_host_devices::delete_all_from_db($conn, $uuid);
        Asset_host_properties::delete_property_from_db($conn, $uuid, 3, '', TRUE);
    } else {
        // Device Type
        if ($dtype == 'networkdevice') {
            Asset_host_devices::save_device_in_db($conn, $uuid, 4);
            //Adding the device type
            Asset_host_properties::delete_property_from_db($conn, $uuid, 3, '', TRUE);
            //Removing the previous OS
        } elseif ($os == 'windows' || $os == 'linux') {
            Asset_host_devices::delete_device_from_db($conn, $uuid, 4);
            //Removing device type
            Asset_host_properties::delete_property_from_db($conn, $uuid, 3);
            //Removing previous OS
            Asset_host_properties::save_property_in_db($conn, $uuid, 3, ucfirst($os), 1, TRUE);
            //Adding the new OS
        }
    }
    $response['error'] = FALSE;
    $response['data'] = array();
    return $response;
}