protected function intoResource($payload)
    {
        // Transformer are intended to singular resources,
        // so what to do with collections
        if ($this->transformer != null) {
            $payload = $this->transformPayload($payload);
        }

        if($payload instanceof Collection || $payload instanceof AbstractPaginator) {
            return is_array($payload->first()) 
                ?  new ResourceCollection($payload->map(function($item) {
                    return new ArrayWrapper($item);
                }))
                : new ResourceCollection($payload);
        }

        if($payload instanceof Arrayable) {
            return $this->instantiateJsonResource($payload);
        }
        
        if(is_array($payload)) {
            return $this->instantiateJsonResource(new ArrayWrapper($payload));
        }
        
        if($payload instanceof \JsonSerializable) {
            return $this->instantiateJsonResource($payload);
        }

        throw new ResponderException("Cannot serialize object");
    }