/// <summary>
        ///    Gets a component of specified type from the Components property of the commerceEntity or creates a new
        ///    component and adds it to the Components property of commerceEntity if the component does not exist.
        /// </summary>
        /// <param name="commerceEntity"></param>
        /// <param name="editedComponentType"></param>
        /// <returns></returns>
        public Sitecore.Commerce.Core.Component GetEditedComponent(CommerceEntity commerceEntity, Type editedComponentType)
        {
            Sitecore.Commerce.Core.Component component = commerceEntity.EntityComponents.SingleOrDefault(comp => comp.GetType() == editedComponentType);
            if (component == null)
            {
                component = (Sitecore.Commerce.Core.Component)Activator.CreateInstance(editedComponentType);
                commerceEntity.AddComponents(component);
            }

            return(component);
        }