Create save appointment function