/// <summary>
 ///
 /// </summary>
 /// <param name="attachedProperty"></param>
 private void EnsureRegistered(AbstractAttachedProperty attachedProperty)
 {
     using (ReadLockScope())
     {
         if (!_attachedProperties.Contains(attachedProperty))
         {
             throw new AttachedPropertyException(
                       string.Format("Attached property named {0} for type {1} is not reigstered in current context",
                                     attachedProperty.Name, attachedProperty.OwnerType.FullName));
         }
     }
 }
        /// <summary>
        /// Register a new attached property in this context.
        /// </summary>
        /// <param name="attachedProperty"></param>
        public void Register(AbstractAttachedProperty attachedProperty)
        {
            using (WriteLockScope())
            {
                var fullName = attachedProperty.FullName;
                if (_attachedProperties.Select(x => x.FullName).Contains(fullName))
                {
                    throw new AttachedPropertyException(
                              string.Format("Attached property named {0} for type {1} is already registered in current context",
                                            attachedProperty.Name, attachedProperty.OwnerType.FullName));
                }

                _attachedProperties.Add(attachedProperty);
            }
        }