public function save(array $data)
    {
        $project_id = empty($data['project_id']) ? 0: (int) $data['project_id'];
        if ($project_id <= 0) {
            throw new Exception('Required field project_id');
        }
        if (empty($data['pending_file_ref']) && empty($data['filename'])) {
            throw new Exception('Required field pending_file_ref or filename');
        }
        if (empty($data['pending_file_ref'])) {
            $data['pending_file_ref'] = $this->upload($data['filename']);
        }
        unset($data['filename']);
        return $this->rest->post("projects/$project_id/files", $data);
    }