public async Task UpdatePictureAsync(string id, [FromForm] MultiPartFile picture) { const int maxFileSize = (int)10e6; if (picture?.File == null) { throw new ArgumentNullException(nameof(picture)); } var objectId = await CanWriteDataToResidentAsync(id); try { var bytes = picture.ConvertToBytes(maxFileSize); await DataService.UpdatePropertyAsync(objectId, x => x.Picture, bytes); } catch (FileToLargeException) { throw new FileToLargeException(maxFileSize); } }