'Define a ModuleSetting'

def set(name, value, **kwargs):

    existing = ModuleSetting.objects.filter(name=name, **kwargs)
    if existing:
        for setting in existing:
            setting.value = value
            setting.save()
    else:
        setting = ModuleSetting(name=name, value=value, **kwargs)
        setting.save()
    return setting
