Updated code to implement persistence of wpNumberOfAppointments