abstracted editTask function