public function createAssetsAction(Request $request, $token)
    {
        if (!$request->isXmlHttpRequest()) {
            return $this->redirectToRoute('_profiler', ['token' => $token]);
        }

        $messages = $this->getSelectedMessages($request, $token);

        if ($messages instanceof Data) {
            $messages = $messages->getValue(true);
        }

        if (empty($messages)) {
            return new Response('No translations selected.');
        }

        $uploaded = array();
        $trans = $this->get('happyr.translation');
        foreach ($messages as $message) {
            if ($trans->createAsset($message)) {
                $uploaded[] = $message;
            }
        }

        $saved = count($uploaded);
        if ($saved > 0) {
            $this->get('happyr.translation.filesystem')->updateMessageCatalog($uploaded);
        }

        return new Response(sprintf('%s new assets created!', $saved));
    }