When actions involving a common question of law or of fact are pending before the court, it may order a joint hearing or trial of any or all the matters in issue in the actions; it may order all the actions consolidated; and to this effect it may make such orders as may tend to avoid unnecessary costs or delay.