public function insert($index, $type, $data, $id = null, $options = [])
    {
        if (empty($data)) {
            $body = '{}';
        } else {
            $body = is_array($data) ? Json::encode($data) : $data;
        }

        if ($id !== null) {
            return $this->db->put([$index, $type, $id], $options, $body);
        } else {
            return $this->db->post([$index, $type], $options, $body);
        }
    }