/// <summary>
        /// Handles the OnDeleteCommand event of the rgWorkflowTemplateGoalElement control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridCommandEventArgs"/> instance containing the event data.</param>
        protected void rgWorkflowTemplateGoalElement_OnDeleteCommand(object sender, GridCommandEventArgs e)
        {
            var gridDataItem = e.Item as GridDataItem;

            if (gridDataItem != null)
            {
                var id = Guid.Parse(gridDataItem.GetDataKeyValue("ID").ToString());
                WorkflowTemplateElements.Remove(WorkflowTemplateElements.FirstOrDefault(s => s.ID == id));
            }
        }
        /// <summary>
        /// Saves the state of to view.
        /// </summary>
        /// <param name="workflowTemplateElementId">The workflow template goal id.</param>
        /// <param name="item">The item.</param>
        private void SaveToViewState(Guid workflowTemplateElementId, GridEditableItem item)
        {
            var workflowTemplateElementMap = WorkflowTemplateElements.FirstOrDefault(s => s.ID == workflowTemplateElementId) ?? new WorkflowTemplateElementMap();

            var workflowTemplateElement = AvailableWorkflowTemplateElements.SingleOrDefault(o => o.ID == (Guid.Parse(((RadComboBox)item.FindControl("rcbWorkflowTemplateElements")).SelectedValue)));

            workflowTemplateElementMap.Name        = workflowTemplateElement.Name;
            workflowTemplateElementMap.ElementType = workflowTemplateElement.ElementType;

            if (workflowTemplateElementMap.ID == Guid.Empty)
            {
                workflowTemplateElementMap.ID = workflowTemplateElement.ID;
                WorkflowTemplateElements.Add(workflowTemplateElementMap);
            }
        }