protected function insertState(Identifier $identifier, $state, $message = null)
{
try {
$data = new \stdClass();
$data->timestamp = time();
$data->state = $state;
$data->entity_id = $identifier->getEntityId();
$data->machine = $identifier->getMachine();
//insert into the 'states' collection
//https://php.net/manual/en/mongocollection.insert.php
$this->getClient()->izzum->states->insert($data);
} catch (\Exception $e) {
throw new Exception(sprintf('query for inserting state failed: [%s]', $e->getMessage()), Exception::PERSISTENCE_LAYER_EXCEPTION);
}
}