def METHOD_NAME(instance, sender, **kwargs):
    """Removes the layer from GeoServer"""
    # cascading_delete should only be called if
    # ogc_server_settings.BACKEND_WRITE_ENABLED == True
    if getattr(ogc_server_settings, "BACKEND_WRITE_ENABLED", True):
        if (
            not hasattr(instance, "remote_service")
            or instance.remote_service is None
            or instance.remote_service.method == CASCADED
        ):
            if instance.alternate:
                geoserver_cascading_delete.apply_async(args=(instance.alternate,), expiration=30)