/**
* Insert or Update a document into the index.
*/
public function InsertUpdate()
{
// Remove all new lines etc. from the json to make it valid
$this->query = str_replace(array('\\n', '\\r'), '', $this->query);
$connection = new Connection();
$command = $connection->createCommand();
$command->insert('api-builder', 'api', $this->query, $this->api->id);
}