Move function for REST into communicationrest class