protected function extractMetaFields(EventInterface $event, $fields, $unsetExtracted = true, $serialize = true)
    {
        $extracted = [
            'meta' => $event->getMetaInfo()
        ];

        if (!is_array($extracted['meta'])) {
            return $extracted;
        }

        if (!$fields ||
            empty($extracted['meta'])
        ) {
            if ($serialize) {
                $extracted['meta'] = $this->serialize($extracted['meta']);
            }

            return $extracted;
        }

        if ($fields === true) {
            $extracted += $extracted['meta'];

            if (!$unsetExtracted) {
                if ($serialize) {
                    $extracted['meta'] = $this->serialize($extracted['meta']);
                }

                return $extracted;
            }

            $extracted['meta'] = $serialize ? $this->serialize([]) : [];

            return $extracted;
        }

        if (is_array($fields)) {
            foreach ($fields as $name => $alias) {
                if (!is_string($name)) {
                    $name = $alias;
                }

                $extracted[$alias] = Hash::get($extracted['meta'], $name);
                if ($unsetExtracted) {
                    $extracted['meta'] = Hash::remove($extracted['meta'], $name);
                }
            }
        }

        if ($serialize) {
            $extracted['meta'] = $this->serialize($extracted['meta']);
        }

        return $extracted;
    }