private function addRangeToContent(Response $response, $collection, $offset, $limit)
    {
        $total = "*";
        if ($collection instanceof Paginator) {
            $total = count($collection);
        }

        $lastResult = $offset + $limit - 1;
        $lastResult = $lastResult < 0 ? 0 : $lastResult;
        $response->headers->set('Content-Range', "$offset-$lastResult/" . $total);

        return $response;
    }