public function findOrCreateBranch(RepositoryInterface $repository, $branchName)
    {
        try {
            return $this->findOneBy(['name' => $branchName, 'repository' => $repository], false);
        } catch (NoResultException $e) {
            $branch = new Branch();
            $branch
                ->setName($branchName)
                ->setRepository($repository);

            $this->persist($branch);

            return $branch;
        }
    }