Size reduction of complex networks preserving modularity