function DataStoreStage._promiseInvokeSavingCallbacks(J)if not next(J._savingCallbacks)then return nil end local F={}for J,P in pairs(J._savingCallbacks)do local T=P()if Promise.isPromise(T)then table.insert(F,T)end end for J,P in pairs(J._stores)do local T=P:_promiseInvokeSavingCallbacks()if T then table.insert(F,T)end end return PromiseUtils.all(F)end

function DataStoreStage:_promiseInvokeSavingCallbacks()
	if not next(self._savingCallbacks) then
		return nil
	end

	local removingPromises = {}
	for _, func in pairs(self._savingCallbacks) do
		local result = func()
		if Promise.isPromise(result) then
			table.insert(removingPromises, result)
		end
	end

	for _, substore in pairs(self._stores) do
		local promise = substore:_promiseInvokeSavingCallbacks()
		if promise then
			table.insert(removingPromises, promise)
		end
	end

	return PromiseUtils.all(removingPromises)
end
