/// <summary>
        /// Create Protected package that contain files or data for backup purpose or moving data from one location to another.
        /// Note that this package can only be readed by EntityWorker.Core
        /// https://github.com/AlenToma/EntityWorker.Core/blob/master/Documentation/Package.md
        /// </summary>
        /// <param name="package"></param>
        /// <returns></returns>
        public byte[] CreatePackage <T>(T package) where T : PackageEntity
        {
            if (package == null)
            {
                throw new EntityException("Package cant be null");
            }

            var packageString = package.ToJson();

            var bytes = System.Text.Encoding.UTF8.GetBytes(packageString);

            return(GzipUtility.Compress(new ByteCipher(GlobalConfiguration.PackageDataEncode_Key, DataCipherKeySize.Key_128).Encrypt(bytes)));
        }
 /// <summary>
 /// Create Protected package that contain files or data for backup purpose or moving data from one location to another.
 /// Note that this package can only be readed by EntityWorker.Core
 /// https://github.com/AlenToma/EntityWorker.Core/blob/master/Documentation/Package.md
 /// </summary>
 /// <param name="package"></param>
 /// <returns></returns>
 public byte[] CreatePackage <T>(T package) where T : PackageEntity
 {
     if (package == null)
     {
         throw new EntityException("Package cant be null");
     }
     using (var mem = new MemoryStream())
     {
         using (var db = new LiteDB.LiteDatabase(mem))
         {
             var packageCollection = db.GetCollection <T>("Packages");
             packageCollection.Insert(package);
             return(GzipUtility.Compress(new ByteCipher(GlobalConfiguration.PackageDataEncode_Key, DataCipherKeySize.Key_128).Encrypt(mem.ToArray())));
         }
     }
 }