prepare for resource deletion.