 (defn- copy-collection-data
   "Copy the dataset/collection data from the catalog rest database to the metadata db
   for the given provider."
-  [db provider-id & collection-id]
-  (info "Copying collection data for provider" provider-id)
-  (j/with-db-transaction
-    [conn db]
-    (j/execute! conn (copy-collection-data-sql provider-id collection-id))))
+  ([db provider-id] (copy-collection-data db provider-id nil))
+  ([db provider-id collection-id] (info "Copying collection data for provider" provider-id)
+   (j/with-db-transaction
+     [conn db]
+     (j/execute! conn (copy-collection-data-sql provider-id collection-id)))))
 
 (defn- copy-granule-data-for-collection-sql
   "Generate the SQL to copy the granule data from the catalog reset datbase to the metadata db."
   [provider-id collection-id dataset-record-id]
-  (let [granule-echo-table (keyword (str (catalog-rest-tablespace) "." provider-id "-granule-records"))
-        granule-mdb-table (keyword (str (metadata-db-tablespace) "." provider-id "-granules"))
-        sequence (keyword (str (metadata-db-tablespace) ".concept_id_seq.NEXTVAL"))]
+  (let [granule-echo-table (catalog-rest-granule-table provider-id)
+        granule-mdb-table (metadata-db-concept-table provider-id :granule)]
     (su/build (insert granule-mdb-table [:concept-id
                                          :native-id
                                          :parent-collection-id

  [provider-id]
  (keyword (str (catalog-rest-tablespace) "." provider-id "-dataset-records")))

(defn create-provider-url
  []
  (format "%s/providers" (metadata-db-url)))

  (copy-provider (oc/create-db (oc/db-spec)) "FIX_PROV1")
  (copy-single-collection (oc/create-db (oc/db-spec)) "FIX_PROV1" "C1000000073-FIX_PROV1")
  (get-provider-collection-list-sql  "FIX_PROV1")
  (copy-granule-data-for-provider (oc/create-db (oc/db-spec)) "FIX_PROV1")
  (delete-collection-granules-sql "FIX_PROV1" "C1000000073-FIX_PROV1")
  (metadata-db-concept-table "FIX_PROV1" :collection)
  )
