Improve associations deletion logic