int maxNumberOfAttempts = 100;
boolean doneWithSecretPals = false;
while (!doneWithSecretPals && numberOfAttempts < maxNumberOfAttempts) {
log.info("attempt #" + numberOfAttempts + " of " + maxNumberOfAttempts);
EOEditingContext nestedEditingContext = ERXEC.newEditingContext(editingContext());
nestedEditingContext.lock();
SPEvent localEvent = localInstanceIn(nestedEditingContext);
try {
for (SPPerson selectedGiver : eligibleGivers) {
NSArray<SPPerson> eligibleReceivers = _eligibleReceiversForPerson(selectedGiver, allPeople, consumedReceivers);
if (eligibleReceivers.count() == 0) {