/// <summary>
        /// Sets the title of the dossier.
        /// </summary>
        /// <param name="db">The database containing the dossier metadata.</param>
        /// <param name="dossier">The dossier to modify.</param>
        /// <param name="newTitle">The new title.</param>
        /// <returns>An entity modification result which may or may not have succeeded.</returns>
        public async Task <ModifyEntityResult> SetDossierTitleAsync
        (
            [NotNull] GlobalInfoContext db,
            [NotNull] Dossier dossier,
            [NotNull] string newTitle
        )
        {
            var isNewNameUnique = await IsDossierTitleUniqueAsync(db, newTitle);

            // If the only thing that has changed is casing, let it through
            if (!isNewNameUnique)
            {
                bool isOnlyCaseChange = false;
                if (!(dossier.Title is null))
                {
                    isOnlyCaseChange = string.Equals(dossier.Title, newTitle, StringComparison.OrdinalIgnoreCase);
                }

                if (!isOnlyCaseChange)
                {
                    return(ModifyEntityResult.FromError(CommandError.MultipleMatches, "A dossier with that title already exists."));
                }
            }

            if (newTitle.Contains("\""))
            {
                return(ModifyEntityResult.FromError(CommandError.Unsuccessful, "The title may not contain double quotes."));
            }

            if (newTitle.IndexOfAny(Path.GetInvalidPathChars()) > -1)
            {
                return(ModifyEntityResult.FromError(CommandError.Unsuccessful, $"The title contains one or more of invalid characters ({Path.GetInvalidPathChars().Humanize("or")})"));
            }

            dossier.Title = newTitle;

            var updateDataResult = await UpdateDossierDataLocationAsync(db, dossier);

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

            await db.SaveChangesAsync();

            return(ModifyEntityResult.FromSuccess(ModifyEntityAction.Edited));
        }