// This method is only used by the client process to save the object store before submitting a job
        // Like other generated files we need to save this file in the temp directory
        public static void Save()
        {
            if (IsEmpty)
            {
                return;
            }
            string objectStorePath = GetClientSideObjectStorePath();

            FileStream      fs  = new FileStream(objectStorePath, FileMode.Create);
            BinaryFormatter bfm = new BinaryFormatter();

            try
            {
                bfm.Serialize(fs, s_objectList);
            }
            catch (SerializationException e)
            {
                foreach (object obj in s_objectList)
                {
                    Type badType = TypeSystem.GetNonserializable(obj);
                    if (badType != null)
                    {
                        if (badType.IsGenericType &&
                            badType.GetGenericTypeDefinition() == typeof(DryadLinqQuery <>))
                        {
                            throw new DryadLinqException(HpcLinqErrorCode.CannotSerializeHpcLinqQuery,
                                                         SR.CannotSerializeHpcLinqQuery);
                        }
                        else
                        {
                            throw new DryadLinqException(HpcLinqErrorCode.CannotSerializeObject,
                                                         string.Format(SR.CannotSerializeObject, obj));
                        }
                    }
                }

                throw new DryadLinqException(HpcLinqErrorCode.GeneralSerializeFailure,
                                             SR.GeneralSerializeFailure, e);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }