public IActionResult Add([FromForm] ContractFileViewModel fileModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }
                fileModel.CreatedOn = CurrentDateTimeHelper.GetCurrentDateTime();
                fileModel.UpdatedOn = CurrentDateTimeHelper.GetCurrentDateTime();
                fileModel.CreatedBy = UserHelper.CurrentUserGuid(HttpContext);
                fileModel.UpdatedBy = UserHelper.CurrentUserGuid(HttpContext);
                fileModel.IsActive  = true;
                fileModel.IsDeleted = false;
                fileModel.IsCsv     = true;
                // gets the contractnumber to save the file in the folder.
                var ContractNumber = _contractRefactorService.GetContractNumberById(fileModel.ResourceGuid);
                if (fileModel.FileToUpload != null || fileModel.FileToUpload.Length != 0)
                {
                    //checks whether the file extension is the correct one and the validates the fields if the file is Csv.
                    var isfileValid = _fileService.UploadFileTypeCheck(fileModel.FileToUpload);
                    // var filename = _fileService.FilePostWithCount($@"{documentRoot}/{ContractNumber}/WorkBreakdownStructure/", fileModel.FileToUpload);
                    if (!isfileValid)
                    {
                        fileModel.IsCsv = false;
                    }
                    else
                    {
                        //Helpers.CsvValidationHelper.ChecksValidHeaderAndReadTheFile(filename, UploadMethodName.WorkBreakDownStructure);
                    }
                    //fileModel.UploadFileName = filename;
                }
                //soft delete the previous uploaded files
                _contractRefactorService.DeleteContractFileByContractGuid(fileModel.ResourceGuid, fileModel.keys);

                var fileEntity = _mapper.Map <ContractResourceFile>(fileModel);
                _contractRefactorService.InsertContractFile(fileEntity);
                return(Ok(new { status = ResponseStatus.success.ToString(), message = "Successfully Added !!" }));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(ex.ToString(), ex.Message);
                return(BadRequest(ModelState));
            }
        }