def METHOD_NAME(self, org, role=None):
    org_id = org.org_id
    try:
        settings = self.get(org_id=org_id)
    except OrgSettings.DoesNotExist:
        settings = self.model(org_id=org_id)
    if role is not None:
        if role in get_available_roles():
            settings.role = role
        else:
            logger.warning('Role %s is not valid' % role)
    settings.save(using=self._db)
    return settings