public function destroyObject(Object $object)
{
$application = $this;
$this->sendCommand('destroyObject', [$object->getLazarusObjectId()], function ($result) use(&$object, $application) {
if ($result == $object->getLazarusObjectId()) {
if ($application->getObject($result)) {
unset($object, $application->{$result});
}
}
});
}