Essential dimension and algebraic stacks