/// <summary>
        /// Encrypts a byte array to a specified file.
        /// </summary>
        /// <param name="serialisedBytes"></param>
        private void EncryptToFile(byte[] serialisedBytes)
        {
            if (serialisedBytes == null)
            {
                throw new ArgumentNullException("Bytes");
            }

            //AES is the advanced encryption standard class for encryption it
            using (AesCryptoServiceProvider encryptAlg = new AesCryptoServiceProvider())
            {
                //The priavte key is the cipher key used to lock and unlock the encryption.
                byte[] key = encryptAlg.Key;
                //The IV is the initialisation vector, a randomised block that is used to securely encrypt the data through cipher block chaining.
                //Where the preceding block encryption output is used to affect the next one.
                byte[] iV = encryptAlg.IV;

                byteProcessor.SaveBytesToFile(KeyPath, key);
                byteProcessor.SaveBytesToFile(IVPath, iV);

                //Padding mode specifies the padding type when a data block is shorter thant the full number of bytes required. AES can use key lengths from  128 - 256 bytes.
                encryptAlg.Padding = PaddingMode.Zeros;

                using (ICryptoTransform transform = encryptAlg.CreateEncryptor(key, iV))
                {
                    using (FileStream fsBets = new FileStream(filePathName, FileMode.OpenOrCreate, FileAccess.ReadWrite))
                    {
                        using (CryptoStream csBets = new CryptoStream(fsBets, transform, CryptoStreamMode.Write))
                        {
                            try
                            {
                                csBets.Write(serialisedBytes, 0, SerialLength);
                                csBets.FlushFinalBlock();
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }
                    }
                }
            }
        }