/// <summary>
        /// Deletes an element and its connections
        /// </summary>
        private void Delete()
        {
            if (SelectedObject is Connector)
            {
                RemoveConnectionByConnector(SelectedObject as Connector);
            }
            if (SelectedObject is Node)
            {
                var node = SelectedObject as Node;
                Connectors.Where(x => x.Start == node || x.End == node).ToList().ForEach(x => RemoveConnectionByConnector(x));
                Nodes.Remove(node);
            }
            if (SelectedObject is Transition)
            {
                var transition = SelectedObject as Transition;
                Connectors.Where(x => x.Start == transition || x.End == transition).ToList().ForEach(x => RemoveConnectionByConnector(x));
                Transitions.Remove(transition);
            }
            if (SelectedObject is InputLadder)
            {
                var input = SelectedObject as InputLadder;
                Connectors.Where(x => x.Start == input || x.End == input).ToList().ForEach(x => RemoveConnectionByConnector(x));
                Inputs.Remove(input);
            }
            if (SelectedObject is OutputLadder)
            {
                var output = SelectedObject as OutputLadder;
                Connectors.Where(x => x.Start == output || x.End == output).ToList().ForEach(x => RemoveConnectionByConnector(x));
                Outputs.Remove(output);
            }

            if (SelectedObject is NotInputLadder)
            {
                var notInput = SelectedObject as NotInputLadder;
                Connectors.Where(x => x.Start == notInput || x.End == notInput).ToList().ForEach(x => RemoveConnectionByConnector(x));
                NotInputs.Remove(notInput);
            }

            if (SelectedObject is NotOutputLadder)
            {
                var notOutput = SelectedObject as NotOutputLadder;
                Connectors.Where(x => x.Start == notOutput || x.End == notOutput).ToList().ForEach(x => RemoveConnectionByConnector(x));
                NotOutputs.Remove(notOutput);
            }


            if (SelectedObject is InterNode)
            {
                var interNode = SelectedObject as InterNode;
                if (Connections.First(x => InterNodes.Contains(interNode)) != null)
                {
                    RemoveConnectionByConnector(Connectors.First(x => x.Start == interNode || x.End == interNode));
                }
                else
                {
                    Connectors.Where(x => x.Start == interNode || x.End == interNode).ToList().ForEach(x => Connectors.Remove(x));
                    InterNodes.Remove(interNode);
                }
            }
        }
 /// <summary>
 /// Removes the Objects that are still in preview mode
 /// </summary>
 public void RemoveNewObjects()
 {
     Connectors.Where(x => (x.Start != null && x.Start.IsNew) || (x.End != null && x.End.IsNew)).ToList().ForEach(x => Connectors.Remove(x));
     Nodes.Where(x => x.IsNew).ToList().ForEach(x => Nodes.Remove(x));
     Transitions.Where(x => x.IsNew).ToList().ForEach(x => Transitions.Remove(x));
     InterNodes.Where(x => x.IsNew).ToList().ForEach(x => InterNodes.Remove(x));
     Connectors.Where(x => x.IsNew).ToList().ForEach(x => Connectors.Remove(x));
     Inputs.Where(x => x.IsNew).ToList().ForEach(x => Inputs.Remove(x));
     NotInputs.Where(x => x.IsNew).ToList().ForEach(x => NotInputs.Remove(x));
     Outputs.Where(x => x.IsNew).ToList().ForEach(x => Outputs.Remove(x));
     NotOutputs.Where(x => x.IsNew).ToList().ForEach(x => NotOutputs.Remove(x));
 }