protected function decorateResourceItems(array $data, $locale)
    {
        return array_map(
            function($item) {
                $itemData = $this->serializer->serialize($item, 'array', $this->getSerializationContext());
                $id = $this->getIdForItem($item);

                if ($this->referenceStore) {
                    $this->referenceStore->add($id);
                }

                return new ArrayAccessItem($id, $itemData, $item);
            },
            $data
        );
    }