Refactor the sendContent() method.