private function extractObjectProperties($object)
    {
        $propertyToValue = [];

        if (method_exists($object, '__sleep')) {
            $properties = $object->__sleep();
            foreach ($properties as $property) {
                $propertyToValue[$property] = $object->$property;
            }

            return $propertyToValue;
        }


        $reflectedProperties = [];
        $ref = new \ReflectionClass($object);
        foreach ($ref->getProperties() as $property) {
            $property->setAccessible(true);
            $propertyToValue[$property->getName()] = $property->getValue($object);
            $reflectedProperties[] = $property->getName();
        }

        $dynamicProperties = array_diff(array_keys(get_object_vars($object)), $reflectedProperties);

        foreach ($dynamicProperties as $property) {
            $propertyToValue[$property] = $object->$property;
        }

        return $propertyToValue;
    }