public function writeToStorage($domain, $translations)
    {
        foreach ($translations as $keys) {
            foreach ($keys as $key => $transMeta) {
                $search = $this->repository->createSearch();
                $search->addQuery(new MatchQuery('key', $key));
                $results = $this->repository->findDocuments($search);
                if (count($results)) {
                    continue;
                }

                $document = new Translation();
                $document->setDomain($domain);
                $document->setKey($key);
                $document->setPath($transMeta['path']);
                $document->setFormat($transMeta['format']);
                foreach ($transMeta['messages'] as $locale => $text) {
                    $message = new Message();
                    $message->setLocale($locale);
                    $message->setMessage($text);
                    $document->addMessage($message);
                }
                $this->manager->persist($document);
            }
        }

        $this->manager->commit();
    }