public async Task <IActionResult> Create(DocumentViewModel viewModel, IList <IFormFile> files, IFormCollection ifc)
        {
            string test = ifc["VisaId"];

            VisaID = test;
            if (ModelState.IsValid)
            {
                await CreateApplicantIfNotExist(viewModel);
                await CreatePurposeIfNotExist(viewModel);

                var document = _mapper.Map <Document>(viewModel);
                try
                {
                    document.VisaId = VisaID;
                    string[]  strArr    = null;
                    RequestId req       = new RequestId();
                    char[]    splitchar = { ',' };
                    if (String.IsNullOrEmpty(VisaID))
                    {
                    }
                    else
                    {
                        strArr = VisaID.Split(splitchar);
                    }



                    await _context.AddAsync(document);

                    await _context.SaveChangesAsync();

                    if (files.Any())
                    {
                        var newFiles = await _fileUploader.GetScannedFilesForDocument(document, files);

                        await _context.ScannedFiles.AddRangeAsync(newFiles);

                        await _context.SaveChangesAsync();
                    }
                    if (String.IsNullOrEmpty(VisaID))
                    {
                    }
                    else
                    {
                        foreach (var id in strArr)
                        {
                            req.Number     = id;
                            req.DocumentId = document.Id;
                            req.Id         = Guid.NewGuid();

                            await _context.AddAsync(req);

                            await _context.SaveChangesAsync();
                        }
                    }

                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception ex) when(ex.GetType() == typeof(DbUpdateException))
                {
                    ModelState.AddModelError("", "Unable to save changes. " +
                                             "Try again, and if the problem persists, " +
                                             "see your system administrator.");
                }
            }

            SetSelectedDropDownLists(viewModel);
            return(View(viewModel));
        }