anchor.diff:          end, GroupStates),
       SortedGroupStates = CanView ++ CannotView,
       #page_state{groups = SortedGroupStates, gruid = GRUID, access_token = AccessToken, expanded_groups = ExpandedGroups}.
  +
  +
  +sort_states(TupleList) ->
  +    ListToSort = lists:map(
  +        fun(T) ->
  +            {string:to_lower(gui_str:binary_to_unicode_list(element(3, T))), element(2, T)}
  +        end, TupleList),
  +    lists:map(
  +        fun({_, StateID}) ->
  +            lists:keyfind(StateID, 2, TupleList)
  +        end, lists:sort(ListToSort)).
   
   
   %% event/1
  
positive.code:                                <<"on">> -> true;
                                 _ -> false
                             end,
  %%                     ?dump({UserID, PrivilegeID, Flag}),
  
                      case proplists:get_value(GroupID, EditedPrivileges, undefined) of
                          undefined ->
  
negative.code:                         end, UsersIDs),
                      #user_state{privileges = CurrentPrivileges} = CurrentUser = lists:keyfind(GRUID, 2, UserStates),
                      UserStatesWithoutCurrent = lists:keydelete(GRUID, 2, UserStates),
                      UserStatesSorted = [CurrentUser | sort_states(UserStatesWithoutCurrent)],
  
                      % Synchronize spaces data (belonging to certain group)
                      {ok, SpacesIDs} = gr_groups:get_spaces({user, AccessToken}, GroupID),
  