Any number of persons claiming liens under this chapter may join in the same action, and when separate actions are commenced the court may consolidate them. The court may also allow, as part of the costs, the moneys paid for filing and recording the claim, and a reasonable attorney's fee for each person claiming a lien.