public function deleteTeam(Team $team)
    {
        $teamRole = $team->getRole();
        $teamManagerRole = $team->getTeamManagerRole();

        if (!is_null($teamManagerRole)) {
            $this->om->remove($teamManagerRole);
        }
        if (!is_null($teamRole)) {
            $this->om->remove($teamRole);
        }
        $teamDirectory = $team->getDirectory();

        if ($team->isDirDeletable() && !is_null($teamDirectory)) {
            $this->resourceManager->delete($teamDirectory->getResourceNode());
        }
        $this->om->remove($team);
        $this->om->flush();
    }