In any action brought pursuant to § 52-418 to vacate an arbitration award rendered in a controversy between a board of education and a teacher or the organization which is the exclusive representative of a group of teachers, or to confirm, pursuant to § 52-417, such an arbitration award, reasonable attorney’s fees and costs may be awarded in accordance with the following: (1) Where the board of education moves to vacate an award and the award is not vacated, the court may award reasonable attorney’s fees and costs to the teacher; (2) where the teacher moves to vacate an award and the award is not vacated, the court may award reasonable attorney’s fees and costs to the board of education; (3) where the teacher moves to confirm an award, if the board of education refuses to stipulate to such confirmation and if the award is confirmed, the court may award reasonable attorney’s fees and costs to the teacher; (4) where the board of education moves to confirm an award, if the teacher refuses to stipulate to such confirmation and if the award is confirmed, the court may award reasonable attorney’s fees and costs to the board of education.