private function createDir($path)
    {
        if (!is_dir($path)) {
            $success = mkdir($path, 0775, true);
            if (!$success) {
                throw new \Exception("Cannot create folder {$path}. Check file system permissions.");
            }
        }
    }