Calling the original `process_dataset` function led to issues with JSON serialisation.
Capturing the instantiation of the database and dataset manager objects inside the try-catch will cause errors if something else fails. If an exception occurs and the dataset_manager is not initialised, the code inside the catch block will fail.