Added part to write proto message to file