refactory sendMedia