Fixed database record deletion not going through all relations.