public function upload($files)
    {
        $files = (array) $files;
        $pending_file_attachments = [];
        foreach ($files as $filename) {
            if (!is_file($filename)) {
                throw new Exception("Not file exist $filename");
            }
        }
        foreach ($files as $filename) {
            $params = ['file'=> self::getFileParam($filename)];
            $pending_file_attachments[] = $this->rest->upload(
                'pendingfiles',
                $params
            );
        }

        return join(',', $pending_file_attachments);
    }