refactored save_reply_relationships to decrease complexity