private static @Nullable ActionGroup createBranchActions(@NotNull Project project,
                                                           @NotNull List<? extends GitRepository> repositories,
                                                           @NotNull GitBranch branch,
                                                           @NotNull GitRepository selectedRepository) {
    if (branch instanceof GitLocalBranch) {
      for (GitRepository repository : repositories) {
        if (!repository.getBranches().getLocalBranches().contains(branch)) return null;
      }

      return new LocalBranchActions(project, repositories, (GitLocalBranch)branch, selectedRepository);
    }
    else if (branch instanceof GitRemoteBranch) {
      for (GitRepository repository : repositories) {
        if (!repository.getBranches().getRemoteBranches().contains(branch)) return null;
      }

      return new RemoteBranchActions(project, repositories, (GitRemoteBranch)branch, selectedRepository);
    }
    else {
      return null;
    }
  }
private static @Nullable ActionGroup createBranchActions(@NotNull Project project,
                                                           @NotNull List<? extends GitRepository> repositories,
                                                           @NotNull GitBranch branch,
                                                           @NotNull GitRepository selectedRepository)