loop in Resource.save error