/// <summary>
        /// Удаляет заявление об отзыве документов абитуриента
        /// </summary>
        /// <param name="revocationStatement"></param>
        /// <returns></returns>
        public async Task RemoveRevocationStatementAsync(RevocationStatement revocationStatement)
        {
            _context.RevocationStatements.Remove(revocationStatement);

            if (revocationStatement.FileModel != null)
            {
                await _fileModelRepository.RemoveFileModelAsync(revocationStatement.FileModel);
            }

            await _context.SaveChangesAsync();
        }
        /// <summary>
        /// Добавляет заявление об отзыве документов
        /// </summary>
        /// <param name="revocationStatement"></param>
        /// <param name="uploadedFile"></param>
        /// <returns></returns>
        public async Task CreateRevocationStatement(RevocationStatement revocationStatement, IFormFile uploadedFile)
        {
            if (uploadedFile != null)
            {
                var newFileModel = await _fileModelRepository.UploadRevocationStatementAsync(uploadedFile);

                if (newFileModel != null)
                {
                    revocationStatement.FileModelId = newFileModel.Id;
                }
            }

            _context.RevocationStatements.Add(revocationStatement);
            await _context.SaveChangesAsync();
        }
        /// <summary>
        /// Обновляет заявление об отзыве документов абитуриента
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="revocationStatement"></param>
        /// <param name="uploadedFile"></param>
        /// <returns></returns>
        public async Task UpdateRevocationStatement(string userName, RevocationStatement revocationStatement, IFormFile uploadedFile)
        {
            var entry = await GetRevocationStatementAsync(revocationStatement.RevocationStatementId);

            if (entry == null || entry.ApplicationForAdmission.Abiturient.AppUser.UserName != userName)
            {
                return;
            }

            if (entry.ApplicationForAdmissionId != revocationStatement.ApplicationForAdmissionId)
            {
                entry.ApplicationForAdmissionId = revocationStatement.ApplicationForAdmissionId;
            }

            if (entry.Date != revocationStatement.Date)
            {
                entry.Date = revocationStatement.Date;
            }

            if (entry.RejectionReason != revocationStatement.RejectionReason)
            {
                entry.RejectionReason = revocationStatement.RejectionReason;
            }

            if (entry.GeneratedPdfDocumentPath != revocationStatement.GeneratedPdfDocumentPath)
            {
                entry.GeneratedPdfDocumentPath = revocationStatement.GeneratedPdfDocumentPath;
            }

            if (entry.Remark != revocationStatement.Remark)
            {
                entry.Remark = revocationStatement.Remark;
            }

            if (entry.RowStatusId != revocationStatement.RowStatusId)
            {
                entry.RowStatusId = revocationStatement.RowStatusId;
            }

            await _context.SaveChangesAsync();

            if (uploadedFile != null)
            {
                if (entry.FileModel != null)
                {
                    await _fileModelRepository.ReloadFileAsync(entry.FileModel, uploadedFile);

                    await _context.SaveChangesAsync();
                }
                else
                {
                    var newFileModel = await _fileModelRepository.UploadRevocationStatementAsync(uploadedFile);

                    entry.FileModel   = newFileModel;
                    entry.FileModelId = newFileModel.Id;

                    await _context.SaveChangesAsync();
                }
            }

            //_context.RevocationStatements.Update(entry);

            //await _context.SaveChangesAsync();
        }