def METHOD_NAME(request):
    response = {}
    response["entries"] = []
    ids = request.POST.getlist("ids[]")
    titles = request.POST.getlist("titles[]")
    EntryCategory.objects.filter(category_owner=request.user).exclude(
        id__in=ids
    ).delete()
    x = 0
    for the_id in ids:
        the_id = int(the_id)
        the_title = titles[x]
        x += 1
        if 0 == the_id:
            # if the category is new, then create new
            the_cat = EntryCategory(
                category_title=the_title, category_owner=request.user
            )
        else:
            # if the category already exists, update the title
            the_cat = EntryCategory.objects.get(pk=the_id)
            the_cat.category_title = the_title
        the_cat.save()
        response["entries"].append(
            {"id": the_cat.id, "category_title": the_cat.category_title}
        )
    status = 201
    return JsonResponse(response, status=status)