Move some code from actionlocalfiletoremote to Utils in order
to avoid redundancy.