public static function remove(&$data, $path, $default = null)
    {
        if (!static::$unsetMarker) {
            static::$unsetMarker = new \stdClass();
        }

        // Call get() with special default value so we can know if the key exists without calling has()
        $value = static::get($data, $path, static::$unsetMarker);

        /*
         * If the path doesn't exist don't call set().
         * This also prevents set() from creating middle arrays to get to the leaf node,
         * which doesn't make sense in this case since we are just trying to remove the leaf node.
         */
        if ($value === static::$unsetMarker) {
            return $default;
        }

        // Set with special marker to unset value at path
        static::set($data, $path, static::$unsetMarker);

        return $value;
    }