/// <summary>
 /// Adds the state to context.
 /// </summary>
 /// <param name="stateKvp">The state KVP.</param>
 private void AddStateToContext(SelectListItem stateKvp)
 {
     SelectedStates.AddNewItem(stateKvp);
     AvailableStates.Remove(stateKvp);
     AvailableStates.MoveCurrentToFirst();
     SelectedStates.CommitNew();
     ApplyContextCommand.RaiseCanExecuteChanged();
 }
        /// <summary>
        /// Called when [remove state command].
        /// </summary>
        /// <param name="state">The state.</param>
        private void OnRemoveStateCommand(SelectListItem state)
        {
            try
            {
                SelectedStates.Remove(state);
                AvailableStates = AvailableStates.SourceCollection.OfType <SelectListItem>()
                                  .Concat(new[] { state })
                                  .OrderBy(item => item.Value != null)
                                  .ThenBy(item => item.Text).ToListCollectionView();

                ApplyContextCommand.RaiseCanExecuteChanged();
            }
            catch (Exception ex)
            {
                Events.GetEvent <ErrorNotificationEvent>().Publish(ex);
            }
        }