def METHOD_NAME(self, *args, **options):
    ignore_errors = options.get('ignore_errors')
    remove_duplicates = options.get('remove_duplicates')
    prune = options.get('prune')
    set_uuid = ast.literal_eval(options.get('set_uuid', 'False'))
    set_attrib = ast.literal_eval(options.get('set_attrib', 'True'))
    set_links = ast.literal_eval(options.get('set_links', 'True'))
    delete_orphaned_thumbnails = options.get('delete_orphaned_thumbnails')
    filter = options.get('filter')
    if not options.get('username'):
        username = None
    else:
        username = options.get('username')
    all_datasets = Dataset.objects.all().order_by('name')
    if filter:
        all_datasets = all_datasets.filter(name__icontains=filter)
    if username:
        all_datasets = all_datasets.filter(owner__username=username)
    for index, layer in enumerate(all_datasets):
        print(f"[{(index + 1)} / {len(all_datasets)}] Updating Dataset [{layer.name}] ...")
        try:
            # recalculate the layer statistics
            if set_attrib:
                set_attributes(layer, overwrite=True)
            if set_uuid and hasattr(settings, 'LAYER_UUID_HANDLER') and settings.LAYER_UUID_HANDLER != '':
                from geonode.layers.utils import get_uuid_handler
                uuid = get_uuid_handler()(layer).create_uuid()
                la = Dataset.objects.filter(resourcebase_ptr=layer.resourcebase_ptr)
                la.update(uuid=uuid)
                layer.refresh_from_db()
            # refresh metadata links
            if set_links:
                set_resource_default_links(layer, layer, prune=prune)
            # refresh catalogue metadata records
            catalogue_post_save(instance=layer, sender=layer.__class__)
            # remove duplicates
            if remove_duplicates:
                remove_duplicate_links(layer)
        except Exception as e:
            import traceback
            traceback.print_exc()
            if ignore_errors:
                logger.error(f"[ERROR] Dataset [{layer.name}] couldn't be updated")
            else:
                raise e
    # delete orphaned thumbs
    if delete_orphaned_thumbnails:
        delete_orphaned_thumbs()