code: func (deallocator *Deallocator) processNewEvent(ctx context.Context, event events.Event) (bool, error) {
  	switch typedEvent := event.(type) {
  	case api.EventDeleteTask:
  		serviceID := typedEvent.Task.ServiceID
  
  		if serviceWithCount, present := deallocator.services[serviceID]; present {
  			if serviceWithCount.taskCount <= 1 {
  				delete(deallocator.services, serviceID)
  				return deallocator.processService(ctx, serviceWithCount.service)
  			}
  			serviceWithCount.taskCount--
  		}
  
  		return false, nil
  	case api.EventUpdateService:
  		return deallocator.processService(ctx, typedEvent.Service)
  	case api.EventUpdateNetwork:
  		return deallocator.processNetwork(ctx, nil, typedEvent.Network, nil)
  	default:
  		return false, nil
  	}
  }
docs: // Processes new events, and dispatches to the right method depending on what
  // type of event it is.
  // The boolean part of the return tuple indicates whether anything was actually
  // removed from the store