Building the saving an edit function