private static void AddConfigPortableFactories(IDictionary <int, IPortableFactory> portableFactories, SerializationOptions options)
        {
            foreach (var factoryOptions in options.PortableFactories)
            {
                if (factoryOptions.Id <= 0)
                {
                    throw new ArgumentException("IPortableFactory factoryId must be positive.");
                }

                if (portableFactories.ContainsKey(factoryOptions.Id))
                {
                    throw new InvalidOperationException($"IPortableFactory with factoryId {factoryOptions.Id} is already registered.");
                }

                portableFactories.Add(factoryOptions.Id, factoryOptions.Service);
            }
        }