Controllability and Observability Preservation for Networked Systems with Time Varying Topologies