update appointment

add update appointment support,
refactor the previous code