private string CalculateFileName(string baseFileName, string contentType, int count)
        {
            var fileName = !string.IsNullOrWhiteSpace(baseFileName) ? baseFileName : "picture";

            if (count > 0)
            {
                fileName = $"{Path.GetFileNameWithoutExtension(fileName)}_{count}{Path.GetExtension(fileName)}";
            }

            if (string.IsNullOrWhiteSpace(Path.GetExtension(fileName)) &&
                !string.IsNullOrWhiteSpace(contentType))
            {
                var mimeFileExt = mimeMapping.GetFileExtensionMapping(contentType);
                fileName = Path.ChangeExtension(fileName, mimeFileExt);
            }

            return(fileName);
        }
 private string GetAvatarFileExt(EditAvatar request) =>
 mimeMapping.GetFileExtensionMapping(request.Avatar.ContentType) ?? Path.GetExtension(request.Avatar.Filename);