public function edit($id, Request $request)
    {
        $content = json_decode($request->getContent(), true);

        if (empty($content)) {
            return;
        }

        $document = $this->get($id);

        if (isset($content['messages'])) {
            $this->updateMessages($document, $content['messages']);
            unset($content['messages']);
        }

        try {
            foreach ($content as $key => $value) {
                $document->{'set'.ucfirst($key)}($value);
            }

            $document->setUpdatedAt(new \DateTime());
        } catch (\Exception $e) {
            throw new \LogicException('Illegal variable provided for translation');
        }

        $this->repository->getManager()->persist($document);
        $this->repository->getManager()->commit();
    }