////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn private void Update(NetworkElement existingNetworkElement, NetworkElement newNetworkElement)
        ///
        /// \brief Updates this object.
        ///
        /// \par Description.
        ///      Starts a ScanAndReport process on the Network component
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 28/12/2017
        ///
        /// \param existingNetworkElement  (NetworkElement) - The existing network element.
        /// \param newNetworkElement       (NetworkElement) - The new network element.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private void Update(NetworkElement existingNetworkElement, NetworkElement newNetworkElement)
        {
            Report("Beginning of update");
            newNetworkElement.Init(existingNetworkElement.ea[ne.eak.Id]);
            complexAttributes.Push(new Attribute()
            {
                Value = existingNetworkElement
            });
            newNetworkElement.ScanAndReport(this, NetworkElement.ElementDictionaries.None, NetworkElement.ElementDictionaries.None);
        }
 /*
  * Reset the values of the network element to the init of the element
  */
 private void ResetToInit(object sender, RoutedEventArgs e)
 {
     if (!EditableCheck())
     {
         return;
     }
     Updated = false;
     networkElement.Init(networkElement[ElementDictionaries.ElementAttributes].Value[NetworkElement.ElementAttributeKeys.Id].Value, false);
     ResetToSaved(false, null);
     networkElement[ElementDictionaries.ElementAttributes].Value[NetworkElement.ElementAttributeKeys.Edited].Value = false;
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn private bool CreateNetworkElementText(ref string fileText)
        ///
        /// \brief Creates network element text.
        ///
        /// \par Description.
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 18/03/2018
        ///
        /// \param [in,out] fileText (ref string) - The file text.
        ///
        /// \return True if it succeeds, false if it fails.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private bool CreateNetworkElementText(ref string fileText)
        {
            NetworkElement networkElement = new NetworkElement();

            networkElement.Init(0);
            string text = eol + @"namespace DistributedAlgorithms" + eol + "{" + eol;

            text += eol + "\t#region /// \\name partial class for " + "NetworkElement";
            text += eol + "\tpublic partial class " + "NetworkElement" + @": " + "IValueHolder";
            text += eol + "\t{";
            text += networkElement.CreateGettersSetters("ne");
            text += eol + "\t}";
            text += eol + "\t#endregion";
            text += eol + "}";
            if (ShowClass(ref fileText, "partial", text, "NetworkElement"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn public static bool CheckIfBelongsToBaseAlgorithmEnum(this IValueHolder valueHolder, NetworkElement networkElement, NetworkElement.ElementDictionaries mainDictionary)
        ///
        /// \brief An IValueHolder extension method that determine if belongs to base algorithm enum.
        ///
        /// \par Description.
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 29/10/2017
        ///
        /// \param valueHolder    The valueHolder to act on.
        /// \param networkElement  (NetworkElement) - The network element.
        /// \param mainDictionary  (ElementDictionaries) - Dictionary of mains.
        ///
        /// \return True if the value holder belongs to the base network element.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public static bool BelongsToBaseAlgorithmEnum(this IValueHolder valueHolder, NetworkElement networkElement, NetworkElement.ElementDictionaries mainDictionary)
        {
            // If the value holder is not attribute get the attribute of the value holder
            Attribute attribute;

            if (!(valueHolder is Attribute))
            {
                attribute = (Attribute)valueHolder.Parent;
            }
            else
            {
                attribute = (Attribute)valueHolder;
            }

            // The condition is that the attribute which is the ancestor of our attribute
            // which is in the main dictionary belongs to the base class
            // Find the ancestor.
            // The parent sequence is ending in the following way
            // null <- networkElement <- Attribute <- mainDictionary <- Attribute
            // We have to find the last element in the chain described below
            // We do it with a loop that advances 2 parameters: The attribute and the chain end
            // The chain end is 4 times the parent of the attribute
            // Get the first chain end (If we cannot end the chain that means that the valueHolder is
            // one of the value holders at the middle of the chain hence they are not attributes in the
            // base classes main dictionary
            IValueHolder chainEnd = attribute;

            for (int idx = 0; idx < 4; idx++)
            {
                chainEnd = chainEnd.Parent;
                if (chainEnd == null && idx != 3)
                {
                    return(false);
                }
            }

            // Find the ancestor
            while (chainEnd != null)
            {
                chainEnd  = chainEnd.Parent.Parent;
                attribute = (Attribute)attribute.Parent.Parent;
            }

            // Decide if the attribute is part of the main dictionary
            if (!((AttributeDictionary)networkElement[mainDictionary]).Values.Any(a => a == attribute))
            {
                return(false);
            }

            // Get the key of the attribute
            dynamic key = attribute.Parent.GetChildKey(attribute);

            if (TypesUtility.CompareDynamics(key, bn.ork.SingleStepStatus))
            {
                int x = 1;
            }

            // Get the base NetworkElement
            Type           baseNetworkElementType = networkElement.GetType().BaseType;
            NetworkElement baseNetworkElement     = (NetworkElement)TypesUtility.CreateObjectFromTypeString(baseNetworkElementType.ToString());

            baseNetworkElement.Init(0);

            // Check if the key is found in the base network element's dictionary
            return(((AttributeDictionary)baseNetworkElement[mainDictionary]).Keys.Any(k => TypesUtility.CompareDynamics(k, key)));
        }