public function addOrRestore(array $data): \Translations\Model\Entity\Language
    {
        if (empty($data['code'])) {
            throw new InvalidArgumentException("Language data is missing 'code' key");
        }

        if (empty($data['is_rtl'])) {
            $data['is_rtl'] = $this->isRtl($data['code']);
        }

        if (empty($data['name'])) {
            $data['name'] = $this->getName($data['code']);
        }

        /**
         * @var \Cake\Datasource\EntityInterface $deletedEntity
         */
        $deletedEntity = $this->find('onlyTrashed')
            ->where(['code' => $data['code']])
            ->first();

        if (!empty($deletedEntity)) {
            return $this->restoreTrash($deletedEntity);
        }

        $newEntity = $this->newEntity();
        $newEntity = $this->patchEntity($newEntity, $data);
        /**
         * @var \Translations\Model\Entity\Language $result
         */
        $result = $this->save($newEntity);

        return $result;
    }