public function commit(UncommittedEvents $events)
    {
        $aggregateId = (string) $events[0]->getAggregateIdentity();
        $stream = fopen($this->dataPath . '/' . $aggregateId, 'a');

        $i = 0;
        foreach ($events as $event) {
            $content = ($i > 0) ? PHP_EOL : '';
            $content .= serialize($event);
            fwrite($stream, $content);
            $i++;
        }

        fclose($stream);
    }