public function serializeRequest(Request $request, $data)
    {
        $format = $this->checkAcceptHeader($request);

        try {
            return $this->serializer->serialize($data, $format);
        } catch (\Exception $e) {
            throw new \RuntimeException('Could not serialize content to \'' . $format .'\' format.');
        }
    }
public function serializeRequest(Request $request, $data)
    {
        $format = $this->checkAcceptHeader($request);

        try {
            return $this->serializer->serialize($data, $format);
        } catch (\Exception $e) {
            throw new \RuntimeException('Could not serialize content to \'' . $format .'\' format.');
        }
    }
@param Request $request
@param string  $data

@return string