                     sort-value (-> last-activity-at
                                 (r/iso8601)
                                 (r/to-epoch-time)
+                                (r/mul 1000)
                                 (r/round))]
                 {:last-activity-at last-activity-at
                  :sort-value sort-value})))

        (boolean? unseen)]}
  (let [index-values (if (sequential? index-value) index-value [index-value])
        order-fn (if (= order :desc) r/desc r/asc)
        unseen-cap-sec (if (zero? config/unseen-cap-days)
                        (* 60 60 24 365 50) ;; default is 50 years cap if no config is set
                        (* 60 60 24 config/unseen-cap-days))]
    (db-common/with-timeout db-common/default-timeout
      (as-> (r/table table-name) query
            (r/get-all query index-values {:index index-name})

         (boolean? count)
         (boolean? unseen)]}
  (let [order-fn (if (= order :desc) r/desc r/asc)
        unseen-cap-ms (if (zero? config/unseen-cap-days)
                        (* 60 60 24 365 50 1000) ;; 50 years cap
                        (* 60 60 24 config/unseen-cap-days 1000))]
    (db-common/with-timeout db-common/default-timeout
      (as-> (r/table "entries") query
       (r/get-all query [[:published org-uuid]] {:index :status-org-uuid})
