1. A method in a selected device to unenroll the selected device from management, comprising: receiving an unenrollment trigger; in response for receiving the unenrollment trigger: 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, wherein a condition is associated with a selected one or more of the unenrollment tasks of the accessed set, and wherein each of the selected unenrollment task is attempted only after the associated condition is determined to be satisfied, and wherein, for a distinguished one of the unenrollment tasks of the accessed set, attempting the unenrollment task further comprises invoking the unenrollment task after interruption of full function of the selected device during a previous attempt of the distinguished unenrollment task.