     (if (contains? rebalancing-colls-set concept-id)
       (seq (disj rebalancing-colls-set concept-id))
       (errors/throw-service-error
-       :bad-request
-       (format "The index set does not contain the rebalancing collection [%s]" concept-id)))))
+        :bad-request
+        (format
+          "The index set does not contain the rebalancing collection [%s]"
+          concept-id)))))
 
 (defn- add-new-granule-index
-  "Adds a new granule index for the given collection. Validates the collection does not already have
-   an index."
+  "Adds a new granule index for the given collection. Validates the collection
+  does not already have an index."
   [index-set collection-concept-id]
   (let [existing-index-names (->> (get-in index-set [:index-set :granule :indexes]) (map :name) set)
         _ (when (contains? existing-index-names collection-concept-id)
             (errors/throw-service-error
              :bad-request
-             (format "The collection [%s] already has a separate granule index" collection-concept-id)))
+             (format
+               "The collection [%s] already has a separate granule index"
+               collection-concept-id)))
         individual-index-settings (get-in index-set [:index-set :granule :individual-index-settings])]
     (update-in index-set [:index-set :granule :indexes]
                conj

  "Marks the given collection as rebalancing in the index set."
  [context index-set-id concept-id]
  (let [index-set (get-index-set context index-set-id)
        ;; Add the collection to the list of rebalancing collections. Also does validation.
        index-set (update-in index-set [:index-set :granule :rebalancing-collections]
                   add-rebalancing-collection concept-id)
        index-set (add-new-granule-index index-set concept-id)]

    ;; Update the index set. This will create the new collection indexes as needed.
    (update-index-set context index-set)))

(defn finalize-collection-rebalancing
  "Removes the collection from the list of rebalancing collections"
  [context index-set-id concept-id]
  (let [index-set (get-index-set context index-set-id)
        ;; Remove the collection from the list of rebalancing collections. Also does validation.
        index-set (update-in index-set [:index-set :granule :rebalancing-collections]
                   remove-rebalancing-collection concept-id)]
    (update-index-set context index-set)))

(defn reset
  "Put elastic in a clean state after deleting indices associated with index-sets and index-set docs."
  [context]
  (let [{:keys [index-name mapping]} es-config/idx-cfg-for-index-sets
        idx-mapping-type (first (keys mapping))
        index-set-ids (map #(first %) (es/get-index-set-ids (context->es-store context) index-name idx-mapping-type))]
    ;; delete indices assoc with index-set
    (doseq [id index-set-ids]
      (delete-index-set context (str id)))))

  [index-set]
  (let [index-set-id (get-in index-set [:index-set :id])
        json-index-set-str (json/generate-string index-set)]
    (when-not (and (integer? index-set-id) (pos? index-set-id))
      (m/invalid-id-msg index-set-id json-index-set-str))))

(defn id-name-existence-check
