Move some delete logic into the handler.