repairs invalidcastexception when casting from nongeneric RestResponse to generic RestResponse<dynamic>