             return Disposables.create()
         }
     }
+    
+    public func changeMemberName(_ memberName: String, in teamID: String) -> Completable {
+        guard let currentUser = Auth.auth().currentUser else {
+            return Completable.error(TeamRepositoryError.notAuthenticated)
+        }
+        let memberID = currentUser.uid
+
+        return Completable.create { observer in
+            let memberRef = Database.database().reference().child("team_members").child(teamID).child(memberID)
+            memberRef.observeSingleEvent(of: .value, with: { snapshot in
+                if !snapshot.exists() {
+                    observer(.error(TeamRepositoryError.notInTeam))
+                } else {
+                    memberRef.setValue(memberName) { (error, _) in
+                        if let error = error {
+                            observer(.error(error))
+                        } else {
+                            observer(.completed)
+                        }
+                    }
+                }
+            }, withCancel: { error in
+                observer(.error(error))
+            })
+            return Disposables.create()
+        }
+    }
 }

    func members(in teamID: String) -> Observable<CollectionEvent<TeamMember>>
    func teams(of memberID: String) -> Observable<CollectionEvent<MemberTeam>>
    
    func createTeam(name: String) -> Single<String>
    func join(to teamID: String) -> Completable
    func leave(from teamID: String) -> Completable
}

public protocol TeamRepositoryResolver {

        return memberTeamsRef.createChildCollectionObservable()
    }
    
    public func createTeam(named name: String, by memberName: String) -> Single<String> {
        return Single.create { observer in
            guard let currentUser = Auth.auth().currentUser else {
                observer(.error(TeamRepositoryError.notAuthenticated))
