Fix bug when saving record without associations