[BACKLOG-194] RepositoryPublishResource.writeFile refactor, doc, and tes...

...t