         resolve { invites, admins }
       else
         resolve { invites }
-
-
-getNewInvitations = (invites, pendingInvitations) ->
-  new Promise (resolve, reject) ->
-    pendingEmails=[]
-
-    pendingInvitations.map (invite) ->
-      pendingEmails.push invite.get('email')
-
-    newInvitations = (invite for invite, i in invites when invite.email not in pendingEmails)
-    resolve { newInvitations }
-
-
-
-updateInviteInput = (index, inputType, value) ->
-
-  { reactor } = kd.singletons
-
-
-  reactor.dispatch actions.SET_TEAM_INVITE_INPUT_VALUE, { index, inputType, value }
-
-
-fetchMembers = (options = {}) ->
-
-  { groupsController, reactor } = kd.singletons
-
-  team = groupsController.getCurrentGroup()
-  reactor.dispatch actions.FETCH_TEAM_MEMBERS_BEGIN, { team }
-
-  team.fetchMembersWithEmail {}, options, (err, users) ->
-    reactor.dispatch actions.FETCH_TEAM_MEMBERS_SUCCESS, { users }
-
-
-fetchMembersRole = ->
-
-  { groupsController, reactor } = kd.singletons
-
-  team = groupsController.getCurrentGroup()
-  reactor.dispatch actions.FETCH_TEAM_MEMBERS_ROLES_BEGIN, { team }
-
-  myId = whoami().getId()
-  teamMemberIds = reactor.evaluate getters.TeamMembersIdStore
-  
-  ids = teamMemberIds.toArray()
-  ids.push myId
-  
-  team.fetchUserRoles ids, (err, roles) ->
-    reactor.dispatch actions.FETCH_TEAM_MEMBERS_ROLES_SUCCESS, roles
 
 
 loadPendingInvites = (invites) ->

        title  = "Invitation is resent to <strong>#{pendingInvitations.get(0).get('email')}</strong>"
        title  = 'All invitations are resent.'  if pendingInvitations.size > 1
        resolve { title }


setSearchInputValue = (value) ->

sendInvitations = (invites, pendingInvites) ->

  new Promise (resolve, reject) ->

    remote.api.JInvitation.create { invitations: invites }, (err) =>
      if err
        return reject { title }
