Added logic that does not allow a device to be deleted if it is
currently assigned.