     
     public func team(for teamID: String) -> Observable<Team?> {
         let dataStore = _resolver.resolveDataStore()
-        return team(for: teamID, dataStore: dataStore)
-    }
-    
-    private func team(for teamID: String, dataStore: DataStore) -> Observable<Team?> {
         let teamPath = dataStore.collection("team").document(teamID)
         return dataStore.observeDocument(at: teamPath)
     }
     
     public func members(in teamID: String) -> Observable<CollectionChange<TeamMember>> {
         let dataStore = _resolver.resolveDataStore()
-        return members(in: teamID, dataStore: dataStore)
-    }
-    
-    private func members(in teamID: String, dataStore: DataStore) -> Observable<CollectionChange<TeamMember>> {
         let teamMemberPath = dataStore.collection("team").document(teamID).collection("member")
         return dataStore.observeCollection(matches: teamMemberPath)
     }

import FirebaseAuth
import RxSwift

public enum TeamRepositoryError: Error {
    case teamNotFound
    case notInTeam
}

public protocol TeamRepository {
    func team(for teamID: String) -> Observable<Team?>
    func members(in teamID: String) -> Observable<CollectionChange<TeamMember>>

        }
    }

    public func updateMember(_ member: TeamMember, in teamID: String) -> Completable {
        let dataStore = self._resolver.resolveDataStore()
        return dataStore.write { writer in
            let teamPath = dataStore.collection("team").document(teamID)
            let teamMemberPath = teamPath.collection("member").document(member.memberID)
            writer.updateDocumentData(member.data, at: teamMemberPath)
        }
    }

    public func updateTeam(_ team: Team) -> Completable {
        let dataStore = self._resolver.resolveDataStore()
        return dataStore.write { writer in
            let teamPath = dataStore.collection("team").document(team.teamID)
            writer.updateDocumentData(team.data, at: teamPath)
        }
    }
}
