def METHOD_NAME(self, queryset, site_queryset, ModelSerializer):
    """
    Converting data to csv.
    :param queryset: queryset that need to be converted
    :type queryset: QuerySet
    """
    from bims.tasks.collection_record import download_collection_record_task
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="download.csv"'
    if not queryset and not site_queryset:
        return JsonResponse({
            'status': 'failed',
            'message': 'Data is empty'
        })
    # Filename
    site_id = self.request.GET.get('siteId')
    search_uri = self.request.build_absolute_uri()
    if queryset:
        query_count = queryset.count()
    else:
        query_count = site_queryset.count()
    today_date = datetime.date.today()
    if not site_id or site_id == '':
        filters = self.request.GET
        title = ''
        for key, value in filters.items():
            if value and value != '' and value != [] and value != '[]':
                filter_title = key + '=' + value + '-'
                title += filter_title
        if title != '':
            title = title[:-1]
            filename = title + '.csv'
        else:
            filename = sha256(
                '%s%s%s' % (
                    search_uri,
                    query_count,
                    today_date).encode('utf-8')
            ).hexdigest()
            filename += '.csv'
    else:
        filename = site_id + '.csv'
    # Check if filename exists
    filename = '{}.csv'.format(sha256(
        filename.encode('utf-8')).hexdigest())
    folder = settings.PROCESSED_CSV_PATH
    path_folder = os.path.join(settings.MEDIA_ROOT, folder)
    path_file = os.path.join(path_folder, filename)
    try:
        os.mkdir(path_folder)
    except OSError as exc:
        if exc.errno != errno.EEXIST:
            raise
        pass
    if os.path.exists(path_file):
        return JsonResponse({
            'status': 'success',
            'filename': filename
        })
    download_collection_record_task.delay(
        path_file,
        self.request.GET,
    )
    return JsonResponse({
        'status': 'processing',
        'filename': filename
    })