1. A method in a selected device to unenroll the selected device from management, comprising: accessing a set of unenrollment tasks that are to be performed on the selected device in order to unenroll the selected device from management; marking all of the unenrollment tasks of the accessed set as not completed; after the marking of all of the unenrollment tasks of the accessed set as not completed, for each of the unenrollment tasks of the accessed set, attempting the unenrollment task until the unenrollment task is marked as completed, wherein attempting the unenrollment task comprises: invoking the unenrollment task; determining whether invocation of the unenrollment task was successful; and only if it is determined that invocation of the unenrollment task was successful, marking the unenrollment task as completed.