Biofilter in water and wastewater treatment