A model for the integrated management of river ecosystems