def METHOD_NAME(
    glitchtip_projects: Sequence[GlitchtipProjectsV1], mail_domain: str
) -> list[Organization]:
    organizations: dict[str, Organization] = {}
    for glitchtip_project in glitchtip_projects:
        organization = organizations.setdefault(
            glitchtip_project.organization.name,
            Organization(name=glitchtip_project.organization.name),
        )
        project = Project(
            name=glitchtip_project.name,
            platform=glitchtip_project.platform,
            slug=glitchtip_project.project_id if glitchtip_project.project_id else "",
        )
        # Check project is unique within an organization
        if project.name in [p.name for p in organization.projects]:
            raise GlitchtipException(f'project name "{project.name}" already in use!')
        for glitchtip_team in glitchtip_project.teams:
            users: list[User] = []
            for role in glitchtip_team.roles:
                for role_user in role.users:
                    users.append(
                        User(
                            email=f"{role_user.org_username}@{mail_domain}",
                            role=get_user_role(organization, role),
                        )
                    )
            team = Team(name=glitchtip_team.name, users=users)
            project.teams.append(team)
            if team not in organization.teams:
                organization.teams.append(team)
            for user in team.users:
                if user not in organization.users:
                    organization.users.append(user)
        organization.projects.append(project)
    return list(organizations.values())