public static bool GetAutoConnect(this IPersistableService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            return(service.GetValue("AutoConnect", true));
        }
        public static SettingsStorage GetStudioSession(this IPersistableService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            return(service.GetValue <SettingsStorage>("StudioSession"));
        }
        public static IEnumerable <CodeReference> GetReferences(this IPersistableService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            return(service.GetValue <CodeReference[]>("References"));
        }
        public static ServerCredentials GetCredentials(this IPersistableService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            return(service.GetValue <ServerCredentials>("StockSharpCredentials"));
        }
        public static void SetAutoConnect(this IPersistableService service, bool autoConnect)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            service.SetValue("AutoConnect", autoConnect);
        }
        public static void SetStudioSession(this IPersistableService service, SettingsStorage session)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            service.SetValue("StudioSession", session);
        }
        public static void SetReferences(this IPersistableService service, IEnumerable <CodeReference> references)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (references == null)
            {
                throw new ArgumentNullException("references");
            }

            service.SetValue("References", references.ToArray());
        }
        public static void SetCredentials(this IPersistableService service, ServerCredentials credentials)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (credentials == null)
            {
                throw new ArgumentNullException("credentials");
            }

            service.SetValue("StockSharpCredentials", credentials);
        }