diary edit function and helper function combine