public function editAsCopy(Request $request, $template)
    {
        $name = $request->get('name');
        $data = $this->getData();

        try
        {
            /**
             * Set workspace identifier
             */
            \PDFGeneratorAPI::setWorkspace($this->userRepository->getWorkspaceIdentifier(Auth::user()));

            $newTemplate = \PDFGeneratorAPI::copy($template, $name);
        }
        catch(Exception $e)
        {
            return response()->json([
                'error' => $e->getMessage()
            ], $e->getCode());
        }

        return redirect()->away(\PDFGeneratorAPI::editor($newTemplate->id, $data));
    }