Add save function to formationManager class