Moving bed biofilm reactor to treat wastewater