private function commitBatch() {

        //Check if there are any operations and commit the batch
        if(count($this->batch->getOperations()))
        {
            $this->client->commitBatch();
        }

        //There are no operations, just end the batch
        else
        {
            $this->client->endBatch();
        }

        //Delete the batch
        $this->batch = null;

    }