/// <summary>
        /// Removes the item.
        /// </summary>
        /// <param name="emailItem">The email item.</param>
        private void RemoveItem(EmailItem emailItem, string oldValue = null)
        {
            //unsubscribe from events
            //
            emailItem.OnRemoveItem -= EmailItemOnRemoveItem;
            emailItem.TitleChanged -= EmailItemValueChanged;
            emailItem.OnSelected   -= EmailItemOnSelected;

            //removes
            //
            if (!string.IsNullOrEmpty(oldValue))
            {
                var itemIndex = Items.IndexOf(oldValue);
                if (itemIndex >= 0)
                {
                    Items.Remove(oldValue);
                }
            }
            else
            {
                Items.Remove(emailItem.Title);
            }

            _wrapPanel.Children.Remove(emailItem);
        }
        /// <summary>
        /// Create the new EmailItem.
        /// </summary>
        private void CreateNewEmailItem()
        {
            if (_wrapPanel.Children.IndexOf(_contentControl) < _wrapPanel.Children.Count - 1)
            {
                _wrapPanel.Children.Remove(_contentControl);
                _wrapPanel.Children.Add(_contentControl);
            }

            if (string.IsNullOrEmpty(Text))
            {
                return;
            }

            //multiply email lines
            //
            var emails = Text.Trim().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).Where(s => !string.IsNullOrWhiteSpace(s)).ToList();

            foreach (var email in emails)
            {
                var inputTextToUpper = email.ToUpper();
                if (Items.Any(s => s.ToUpper() == inputTextToUpper))
                {
                    continue;
                }

                //Add new email item
                //
                Items.Add(email);
                var emailItem = new EmailItem
                {
                    Title = email
                };

                //subscribe to events
                //
                emailItem.OnRemoveItem += EmailItemOnRemoveItem;
                emailItem.TitleChanged += EmailItemValueChanged;
                emailItem.OnSelected   += EmailItemOnSelected;

                _wrapPanel.Children.Insert(_indexSelectedElement >= 0 ?_indexSelectedElement : _wrapPanel.Children.Count > 0 ? _wrapPanel.Children.Count - 2 : 0, emailItem);
            }


            Text = string.Empty;
        }