 
 		$scope.cancel = () ->
 			$modalInstance.dismiss()
-	]+	]

				$scope.inputs.contacts = []
				$scope.state.error = null
				$scope.state.inflight = true
				
				currentMemberEmails = getCurrentMemberEmails()
				do addNextMember = () ->
					if members.length == 0 or !$scope.canAddCollaborators
						$scope.state.inflight = false
						$scope.$apply()
						return
					
					member = members.shift()
					if !member.type? and member.display in currentMemberEmails
						# Skip this existing member
						return addNextMember()
					
					if member.type == "user"
						request = projectMembers.addMember(member.email, $scope.inputs.privileges)
					else if member.type == "group"
						request = projectMembers.addGroup(member.id, $scope.inputs.privileges)
					else # Not an auto-complete object, so email == display
						request = projectMembers.addMember(member.display, $scope.inputs.privileges)
					
					request
						.success (data) ->
							if data.users?

								users = [data.user]
							else
								users = []

							$scope.project.members.push users...
							setTimeout () ->
								# Give $scope a chance to update $scope.canAddCollaborators
