/// <summary>
            /// Creates the complex source field.
            /// </summary>
            /// <param name="field">The field.</param>
            /// <param name="owner">The owner.</param>
            /// <returns>The SourceField.</returns>
            private SourceField CreateComplexSourceField(ServiceExposedTypeFieldEdit field, ExpressionObjectBase owner)
            {
                var type = _knownTypes.First(t => t.Guid == field.TypeGuid);
                var dataType = field.AllowMultiple ? NodeDataType.Array : NodeDataType.Entity;
                var result = new SourceField(owner)
                    {
                        DataType = dataType,
                        Name = field.Name,
                        ConnectorOut = { DataType = dataType, Name = field.Name },
                        SystemName = field.Name,
                        SetName = SourceFieldSetNames.IntegrationServiceSourceItem,
                        SubfieldsRetriever = new ComplexTypeSubfieldsRetriever(type, _knownTypes)
                    };

                return result;
            }
            /// <summary>
            /// Creates the primitive source field.
            /// </summary>
            /// <param name="field">The field.</param>
            /// <param name="owner">The owner.</param>
            /// <returns>The SourceField.</returns>
            private SourceField CreatePrimitiveSourceField(ServiceExposedTypeFieldEdit field, ExpressionObjectBase owner)
            {
                var type = ServicePrimitiveTypes.FindByGuid(field.TypeGuid);
                var dataType = field.AllowMultiple
                                   ? NodeDataType.Array
                                   : SourceNodeFactory.GetDataType(type.Type);
                var subfieldsRetriever = field.AllowMultiple ? new ArraySubfieldsRetriever(type) : null;

                if (ReferenceEquals(type, ServicePrimitiveTypes.Byte))
                {
                    dataType = NodeDataType.ByteArray;
                    subfieldsRetriever = null;
                }

                var result = new SourceField(owner)
                                 {
                                     DataType = dataType,
                                     Name = field.Name,
                                     ConnectorOut = { DataType = dataType, Name = field.Name },
                                     SetName = SourceFieldSetNames.IntegrationServiceSourceItem,
                                     InnerName = field.Name,
                                     SystemName = field.Name,
                                     SubfieldsRetriever = subfieldsRetriever
                                 };

                return result;
            }
            /// <summary>
            /// Creates the source field.
            /// </summary>
            /// <param name="field">The field.</param>
            /// <param name="owner">The owner.</param>
            /// <returns>The SourceField.</returns>
            /// <exception cref="System.InvalidOperationException">Field type not found.</exception>
            private SourceField CreateSourceField(ServiceExposedTypeFieldEdit field, ExpressionObjectBase owner)
            {
                if (ServicePrimitiveTypes.GetTypes().Any(t => t.Guid == field.TypeGuid))
                    return CreatePrimitiveSourceField(field, owner);

                if (_knownTypes.Any(t => t.Guid == field.TypeGuid))
                    return CreateComplexSourceField(field, owner);

                throw new InvalidOperationException("Field type not found.");
            }
            /// <summary>
            /// Determines whether this instance [can be source field] the specified field.
            /// </summary>
            /// <param name="field">The field.</param>
            /// <returns><c>true</c> if this instance [can be source field] the specified field; otherwise, <c>false</c>.</returns>
            private bool CanBeSourceField(ServiceExposedTypeFieldEdit field)
            {
                if (ServicePrimitiveTypes.GetTypes().Any(t => t.Guid == field.TypeGuid))
                    return true;

                if (_knownTypes.Any(t => t.Guid == field.TypeGuid))
                    return true;

                return false;
            }
 /// <summary>
 /// Executes the remove field.
 /// </summary>
 /// <param name="field">The field.</param>
 private void ExecuteRemoveField(ServiceExposedTypeFieldEdit field)
 {
     Model.Fields.Remove(field);
 }
 /// <summary>
 /// Determines whether this instance [can remove field] the specified field.
 /// </summary>
 /// <param name="field">The field.</param>
 /// <returns><c>true</c> if this instance [can remove field] the specified field; otherwise, <c>false</c>.</returns>
 private bool CanRemoveField(ServiceExposedTypeFieldEdit field)
 {
     return field != null;
 }