public function toResource($object): ResourceObject
    {
        $context = $this->createContext(get_class($object));

        $id   = $this->identifierHandler->getIdentifier($object, $context);
        $type = $this->resolveType($object, $context);

        $resource = new ResourceObject($id, $type);

        foreach ($this->handlers as $handler)
        {
            $handler->toResource($object, $resource, $context);
        }

        return $resource;
    }