Can an H1B worker consult part-time for a foreign company?

Can a foreign worker working in the US on an H-1B visa consult part-time for a company out of the US? Thanks.