Refactored to use category ID as primary identifier for budgets.