protected function transform($data, $hypertextRoutes = [])
    {
        $links = $this->getHypertextJson($hypertextRoutes);
        if ($links && is_array($data)) {
            $data['_links'] = $links;
        } elseif ($links && !is_array($data)) {
            $data = [$data, '_links' => $links];
        }
        return json_encode($data);
    }