public function preSave(Event $event, Query $query, $id, array &$data) {
        $repo = $this->getRepository();
        $converters = $this->getConverters();

        foreach ($data as $key => $value) {
            if (empty($converters[$key])) {
                continue;
            }

            $converter = $converters[$key];

            // Exit if encoding should not happen
            if (!$converter['encode']) {
                continue;
            }

            switch ($converter['type']) {
                case self::SERIALIZE:   $value = $this->toSerialize($value, $converter); break;
                case self::JSON:        $value = $this->toJson($value, $converter); break;
                case self::BASE64:      $value = $this->toBase64($value, $converter); break;
                case self::CUSTOM:
                    if (method_exists($repo, $converter['encode'])) {
                        $value = call_user_func_array([$repo, $converter['encode']], [$value, $converter]);
                    }
                break;
            }

            $data[$key] = $value;
        }

        return true;
    }