private function encodeSingle(ObjectInterface $action_result, ResponseInterface $response)
    {
        $result = ['single' => $action_result];

        foreach ($action_result->jsonSerializeDetails() as $k => $v) {
            if ($k == 'single') {
                throw new LogicException("JSON serialize details can't overwrite 'single' property");
            } else {
                $result[$k] = $v;
            }
        }

        $response = $response->write(json_encode($result))->withStatus(200);

        if ($action_result instanceof EtagInterface) {
            $response = $response->withHeader('Etag', $action_result->getEtag($this->user_identifier));
        }

        return $response;
    }