public static function normalize($expression)
    {
        if (is_callable($expression)) {
            $expressionConfigurator = $expression;
            $expression = new Expression;
            call_user_func($expressionConfigurator, $expression);
        }

        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (is_array($expression)) {
            foreach ($expression as $fieldName => $value) {
                $expression[$fieldName] = self::normalize($value);
            }
        }

        return $expression;
    }