/// <summary>
        /// Deletes a dossier from the database.
        /// </summary>
        /// <param name="db">The database where dossier metadata is stored.</param>
        /// <param name="dossier">The dossier to delete.</param>
        /// <returns>A deletion result which may or may not have succeeded.</returns>
        public async Task <DeleteEntityResult> DeleteDossierAsync
        (
            [NotNull] GlobalInfoContext db,
            [NotNull] Dossier dossier
        )
        {
            var deleteContentResult = await this.Content.DeleteDossierDataAsync(dossier);

            if (!deleteContentResult.IsSuccess)
            {
                return(deleteContentResult);
            }

            db.Dossiers.Remove(dossier);
            await db.SaveChangesAsync();

            return(DeleteEntityResult.FromSuccess());
        }
        public Task <DeleteEntityResult> DeleteDossierDataAsync([NotNull] Dossier dossier)
        {
            var dataPath = GetDossierDataPath(dossier);

            if (!File.Exists(dataPath))
            {
                return(Task.FromResult(DeleteEntityResult.FromSuccess()));
            }

            try
            {
                File.Delete(dataPath);
            }
            catch (Exception e)
            {
                return(Task.FromResult(DeleteEntityResult.FromError(CommandError.Exception, e.Message)));
            }

            return(Task.FromResult(DeleteEntityResult.FromSuccess()));
        }