public function associateAbilityToResources(Ability $ability, array $nodes)
    {
        $associatedNodes = [];

        foreach ($nodes as $node) {
            if (!$ability->isLinkedToResource($node)) {
                $ability->linkResource($node);
                $associatedNodes[] = $node;
            }
        }
        $this->om->persist($ability);
        $this->om->flush();

        return $associatedNodes;
    }