Avoid hitting the database twice for primary image