The competent authorities of the Member States shall cooperate with each other and with ESMA and the ESRB whenever necessary for the purpose of carrying out their duties under this Directive or of exercising their powers under this Directive or under national law .