def METHOD_NAME(object_id=None, owner=None):
    layer = Dataset.objects.get(pk=object_id) if object_id else Dataset.objects.all().first()
    if not owner:
        owner = get_user_model().objects.get(username="admin")
    for style in styles:
        new_style, created = Style.objects.get_or_create(
            name=style["name"], defaults=dict(sld_url=style["sld_url"], sld_body=style["sld_body"])
        )
        if new_style not in layer.styles.all():
            layer.styles.add(new_style)
            layer.default_style = new_style
    layer.owner = owner
    layer.save()
    for attr in attributes:
        Attribute.objects.update_or_create(
            dataset=layer,
            attribute=attr["attribute"],
            attribute_label=attr["attribute_label"],
            attribute_type=attr["attribute_type"],
            visible=attr["visible"],
            display_order=attr["display_order"],
        )