Fixed infinite loop problem on delete by extracting method to keep DRY