Add utils methods for writing local and remote files. Change-Id: I8f74909e9e4842668f41fc74452fbcb8e3350b59