public Tuple <string, string, bool> UploadProductPdf(long?productID, string FileDescription, IFormFile file)
        {
            Tuple <string, string, bool> oldFile = new Tuple <string, string, bool>("", "", false);
            string newFilePath = "";
            bool   hasFile     = false;

            //check then if there exist already one old file
            if (productID != 0)
            {
                oldFile = repository.GetSpecificationFilePathOfProduct(productID.Value);
            }

            if (file != null)
            {
                //Get the original file name
                var newFileName = Path.GetFileName(file.FileName);

                //Get the extension of the file
                string newFileExt = Path.GetExtension(file.FileName);

                //Get the new file path which is under wwwroot\hardwarePdf
                // Maybe a option to change the file name...
                newFilePath = Path.Combine(hostingEnv.WebRootPath, "hardwarePdf", newFileName);

                //Check if the file is not empty
                if (newFileName.Length > 0 && newFileExt.ToLower() == ".pdf")
                {
                    // If new file is different than local one, remove the old local PDF file.
                    if (newFilePath != oldFile.Item2)
                    {
                        // string fullPath = Request.MapPath("~/uploaded/" + file);
                        if (System.IO.File.Exists(oldFile.Item2))
                        {
                            System.IO.File.Delete(oldFile.Item2);
                        }
                    }

                    //Save the new file
                    using (var fileSteam = new FileStream(newFilePath, FileMode.Create))
                    {
                        file.CopyTo(fileSteam);
                    }

                    hasFile = true;
                }
                else
                {
                    return(new Tuple <string, string, bool>(oldFile.Item1, oldFile.Item2, oldFile.Item3));
                }
            }
            else
            {
                return(new Tuple <string, string, bool>(oldFile.Item1, oldFile.Item2, oldFile.Item3));
            }

            return(new Tuple <string, string, bool>(FileDescription, newFilePath, hasFile));
        }