public function filter_data_for_persistent($data) {
        $data = parent::filter_data_for_persistent($data);

        $classname = static::$persistentclass;
        $properties = $classname::properties_definition();

        $data = (object) array_filter((array) $data, function($value, $key) use ($properties) {
            return isset($properties[$key]);
        }, ARRAY_FILTER_USE_BOTH);

        return $data;
    }