public ActionResult Download(GeneratedXMLModel generatedViewModel,string filename = null)
        {
            //taken from stackoverflow : http://stackoverflow.com/questions/11260550/calling-save-dialog-box-from-javascript
            var document = generatedViewModel.GeneratedFix;
            string _filename;

            if (filename == null) {
                var y = Enum.Parse(typeof(SunTransactionType), SunTransactionType.CONTRA.ToString());
                _filename = generatedViewModel.PPReference;

                if (generatedViewModel.SunFixType == SunFixType.Sun)
                    _filename =  _filename + "_" +  generatedViewModel.transactionType.ToString();

            }
            else
            {
                _filename = filename;
            }
            var cd = new System.Net.Mime.ContentDisposition
            {
                FileName = _filename,
                // always prompt the user for downloading, set to true if you want
                // the browser to try to show the file inline
                Inline = false,
            };
            //Response.AppendHeader("Content-Disposition", cd.ToString());
            if (filename == null)
                if (generatedViewModel.SunFixType == SunFixType.Trader)
                    return File(new System.Text.UTF8Encoding().GetBytes(document), "application/octet-stream", _filename+".sql");
                else
                    return File(new System.Text.UTF8Encoding().GetBytes(document), "application/octet-stream", _filename+".xml");
            else{
                string filePath = Path.Combine(Server.MapPath("~/"), "Temp",filename);
                return File(filePath, "application/octet-stream", DateTime.Now.ToString("yyyyMMddHHmm")+".zip");
            }
        }
        public ActionResult GenerateFix(SunFixAttributes sunFixAttributes)
        {
            CCTransaction ccTransaction = sunService.GetTransactionByCCTransactionId(sunFixAttributes.CCTransactionId);

            if (!ModelState.IsValid)
            {
                List<String> errorMessages = new List<String>();
                ModelState.Values.ToList().ForEach(modelStateValues =>
                {
                    if (modelStateValues.Errors.Count > 0)
                    {
                        errorMessages.AddRange(modelStateValues.Errors.Select(error => error.ErrorMessage));
                    }
                });

                @ViewBag.Error = errorMessages.Select(e => e);
                @ViewBag.SearchText = ccTransaction.BrokerReference;
                return View("SearchResults", sunService.GetCreditControlTransaction(ccTransaction.BrokerReference));
            }

            string generatedFix = sunService.GetFix(sunFixAttributes);

            GeneratedXMLModel viewModel = new GeneratedXMLModel();
            viewModel.GeneratedFix = generatedFix;
            viewModel.SunFixType = sunFixAttributes.SunFixType;
            viewModel.PPReference = ccTransaction.Reference;
            viewModel.transactionType = sunFixAttributes.TransactionType;

            return View("GeneratedFix",viewModel);
        }