public function save(EntityInterface $entity, $id = null) { $params = []; $params['body'] = $entity->toArray(); $params['index'] = static::getIndex(); $params['type'] = static::getType(); $params['id'] = $entity->getId(); $ret = $this->client->index($params); if ($ret['created']) { return true; } else { throw new \Exception('Could not create booking'); } }