     return members
 ]
 
+sortedMembersWithPendingInvitations = [
+  membersWithPendingInvitations
+  (members) ->
+
+    members.sortBy (member) ->
+      if member
+        if member.get('status') is 'pending'
+          member.get('firstName')  if member.get 'firstname'
+          member.get('lastName')  if member.get 'lastName'
+          member.get('email')
+        else
+          member.getIn(['profile', 'firstName'])  if member.getIn(['profile', 'firstName'])
+          member.getIn(['profile', 'lastName'])  if member.getIn(['profile', 'lastName'])
+          member.getIn(['profile', 'email'])
+]
+
 
 filteredMembersWithRole = [
-  membersWithPendingInvitations
+  sortedMembersWithPendingInvitations
   searchInputValue
   (members, value) ->
     return members  if value is ''

toImmutable = require 'app/util/toImmutable'
immutable   = require 'immutable'
isEmailValid = require 'app/util/isEmailValid'


team = ['TeamStore']

  re = new RegExp(value, 'i')

  if member.get('status') is 'pending'
    re.test(member.get('firstName')) or \
    re.test(member.get('lastName')) or \
    re.test(member.get('email'))
  else
    re.test(member.get('profile').get('firstName')) or \
    re.test(member.get('profile').get('lastName')) or \
    re.test(member.get('profile').get('email'))


membersWithPendingInvitations = [
