 		Realm.Configuration.defaultConfiguration = config
 	}
 	
-	// MARK: - Helper functions
-	/*
-	private static func runOnMain<T>(execute: @escaping () -> (T?) ) -> T? {
-		var result: T?
-		let mainSemaphore = DispatchSemaphore(value: 0)
-		DispatchQueue.main.async { () in
-			result = execute()
-			mainSemaphore.signal()
-		}
-		mainSemaphore.wait()
-		return result
-	}
-	
-	private static func runOnMain<A, R>(execute: @escaping (A) -> (R?), param: A) -> R? {
-		var result: R?
-		let mainSemaphore = DispatchSemaphore(value: 0)
-
-		DispatchQueue.main.async {
-			result = execute(param)
-			mainSemaphore.signal()
-		}
-
-		mainSemaphore.wait()
-		return result
-	}
-	
-	private static func runOnMain<A1, A2, R>(execute: @escaping (A1, A2) -> (R?), param1: A1, param2: A2) -> R? {
-		var result: R?
-		let mainSemaphore = DispatchSemaphore(value: 0)
-		DispatchQueue.main.async { () in
-			result = execute(param1, param2)
-			mainSemaphore.signal()
-		}
-		mainSemaphore.wait()
-		return result
-	}*/
-	
 	// MARK: - Deck operations
 	
 	static func getDeck(with id: String) -> Deck? {

			if decks[deck.playerClass] == nil {
				decks[deck.playerClass] = [Deck]()
			}
			decks[deck.playerClass]?.append(deck)
		}
		return decks

            Log.error?.message("Error accessing Realm database")
            return nil
        }
		
		let decks = Array(realm.objects(Deck.self))
		
		for deck in decks {
			RealmHelper.validateCardCounts(deck)
		}
		return decks
    }
	
	static func getActiveDecks() -> [CardClass: [Deck]]? {
