public function store($resource)
    {
        if (!$resource instanceof LocalResource) {
            throw new \InvalidArgumentException('Resource is not local.');
        }

        $file = $this->directory.'/'.$resource->getPath();
        @mkdir(dirname($file), 0777, true);
        file_put_contents($file, $resource->getContent());
        return new MaterializedResource($resource, $this->directory);
    }