public function moveTagsAction(Request $request, Tag $parentTag = null)
    {
        $this->denyAccessUnlessGranted('ez:tags:edit');

        $tagIds = $request->request->has('Tags') ?
            $request->request->get('Tags') :
            $this->get('session')->get('ngtags_tag_ids');

        if (empty($tagIds)) {
            return $this->redirectToTag($parentTag);
        }

        $tags = [];
        foreach ($tagIds as $tagId) {
            $tags[] = $this->tagsService->loadTag($tagId);
        }

        $form = $this->createForm(
            MoveTagsType::class,
            [
                'parentTag' => $parentTag instanceof Tag ? $parentTag->id : 0,
            ],
            [
                'tags' => $tags,
                'action' => $request->getPathInfo(),
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            try {
                $newParentTag = $this->tagsService->loadTag($form->getData()['parentTag']);
            } catch (NotFoundException $exception) {
                $newParentTag = null;
            }

            foreach ($tags as $tagObject) {
                $this->tagsService->moveSubtree($tagObject, $newParentTag);
            }

            $this->addFlashMessage('success', 'tags_moved');

            return $this->redirectToTag($parentTag);
        }

        return $this->render(
            '@NetgenTags/admin/tag/move_tags.html.twig',
            [
                'parentTag' => $parentTag ?: null,
                'tags' => $tags,
                'form' => $form->createView(),
            ]
        );
    }