def METHOD_NAME(self, group_data, group_create_method):
    creator = models.User.get_by_username(
        self.db, group_data.pop("creator_username"), group_data["authority"]
    )
    assert creator
    organization = (
        self.db.query(models.Organization)
        .filter_by(pubid=group_data.pop("organization_pubid"))
        .one()
    )
    group = self.group_service.fetch_by_pubid(group_data["pubid"])
    if not group:
        group = group_create_method(group_data.pop("name"), creator.userid, [])
    group.creator = creator
    group.organization = organization
    group.scopes = [
        models.GroupScope(scope=scope) for scope in group_data.pop("scopes")
    ]
    self.setattrs(group, group_data)