public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary)
    {
        $viewModes = $this->viewModes();
        $query->formatResults(function ($results) use ($viewModes) {
            return $results->map(function ($instance) use ($viewModes) {
                if (!is_object($instance)) {
                    return $instance;
                }

                foreach ($viewModes as $viewMode) {
                    $instanceViewModes = $instance->view_modes;
                    $viewModeDefaults = array_merge([
                        'label_visibility' => 'above',
                        'shortcodes' => false,
                        'hidden' => false,
                        'ordering' => 0,
                    ], (array)$instance->defaultViewModeSettings($viewMode));

                    if (!isset($instanceViewModes[$viewMode])) {
                        $instanceViewModes[$viewMode] = [];
                    }

                    $instanceViewModes[$viewMode] = array_merge($viewModeDefaults, $instanceViewModes[$viewMode]);
                    $instance->set('view_modes', $instanceViewModes);
                }

                $settingsDefaults = (array)$instance->defaultSettings();
                if (!empty($settingsDefaults)) {
                    $instanceSettings = $instance->get('settings');
                    foreach ($settingsDefaults as $k => $v) {
                        if (!isset($instanceSettings[$k])) {
                            $instanceSettings[$k] = $v;
                        }
                    }
                    $instance->set('settings', $instanceSettings);
                }

                return $instance;
            });
        });
    }