Added persistence functions to save a network to a directory