/**
* {@inheritdoc}
*/
public function clear()
{
$root = new GenericResource('/');
$root->attachTo($this);
// Subtract root
$removed = count($this->resources) - 1;
$this->resources = array('/' => $root);
$this->clearVersions();
$this->storeVersion($root);
return $removed;
}