public static function convertObjectToArray($subject): array
    {
        if (!is_object($subject) && !is_array($subject)) {
            throw new \InvalidArgumentException('convertObjectToArray expects either array or object as input, ' . gettype($subject) . ' given.', 1287059709);
        }
        if (is_object($subject)) {
            $subject = (array)$subject;
        }
        foreach ($subject as $key => $value) {
            if (is_array($value) || is_object($value)) {
                $subject[$key] = self::convertObjectToArray($value);
            }
        }
        return $subject;
    }