private function pruneNodes( &$roles )
	{
		$this->log()->info( "Prune" );
		foreach ( $roles as $roleKey => &$role )
		{
			if ( isset( $role['locators'] ) ) unset( $role['locators'] );
			if ( isset( $role['paths'] ) ) unset( $role['paths'] );

			foreach ( $role['hierarchy'] as $headingKey => &$heading )
			{
				// If not used, prune
				if ( ! isset( $heading['used'] ) )
				{
					// $this->log()->info( "Prune $headingKey" );
					unset( $role['hierarchy'][ $headingKey ] );
					continue;
				}

				if ( ! isset( $role['hierarchy'][ $headingKey ]['taxonomy_element'] ) )
				{
					$taxonomy = $this->getTaxonomy()->getTaxonomyForXSD( $heading['label'] );
					$role['hierarchy'][ $headingKey ]['taxonomy_element'] = $taxonomy->getElementById( $heading['label'] );
				}

				$me = $this;
				$pruneNodes = function( &$nodes ) use( &$pruneNodes, &$role, $me )
				{
					foreach ( $nodes as $nodeKey => &$node )
					{
						// If not used, prune
						if ( ! isset( $node['used'] ) )
						{
							unset( $nodes[ $nodeKey ] );
							continue;
						}
						else if ( isset( $node['children'] ) )
						{
							$pruneNodes( $node['children'] );
						}

						if ( ! isset( $node['taxonomy_element'] ) )
						{
							$taxonomy = $me->getTaxonomy()->getTaxonomyForXSD( $node['label'] );
							$node['taxonomy_element'] = $taxonomy->getElementById( $node['label'] );
						}
					}
				};

				$pruneNodes( $heading['children'] );
				unset( $me );
			}

			if ( count( $role['hierarchy'] ) === 0 )
			{
				unset( $roles[ $roleKey ] );
			}
		}
	}