I am attempting to add elements to an array defined within a Dictionary as follows:

```
var eventsByQuarter = Dictionary<Int, [D_MatchEvents]>()

```

The dictionary holds the details of events in a sports match where the key is the quarter of the match concerned. i.e. every event for quarter 1 is in the array assigned to this dictionary item (I will use the dictionary later as the data source for a table view with 4 sections). 

`D_MatchEvents` is defined by `Core Data` and has a many-to-one relationship with a `MatchData` entity. The 'quarter' for each event is already captured as one of the attributes within the `MatchEvents` entity.

```
func loadMatchEvents() {
    match = DatabaseController.fetchMatch(matchUUID)!
    matchEvents = match?.r_ToEvents?.allObjects as! [D_MatchEvents]
    matchEvents = matchEvents.sorted() {($0.d_EventTimestamp?.compare($1.d_EventTimestamp as! Date) == .orderedAscending)}

    for event in matchEvents {
        eventsByQuarter[event.d_EventQuarter] = eventsByQuarter.append(event)
    }
}

```

`matchEvents` is correctly loaded as a sorted array of type `D_MatchEvents`, but when I try to loop through the array appending each event to the correct "quarter" array in the Dictionary I get an ambiguous error when trying to reference member 'subscript'. 

I cannot see how I can achieve this. Any help would be appreciated.