public async Task <Announcement> RegisterAnnouncement(string title, string body, int announcementGenre, DateTime?endDate, string fileName, Stream fileStream) { var announcement = new Announcement( new AnnouncementTitle(title), body, Enumeration.FromValue <AnnouncementGenre>(announcementGenre), new RegisteredDate(DateTime.Today), endDate.HasValue ? new EndDate(endDate.Value) : null, attachedFilePath: null); if (this.HasAttachment(fileName)) { var filePath = await this.fileAccessor.UploadAsync(fileName, fileStream); announcement.ChangeAttachedFilePath(new AttachedFilePath(filePath)); } return(await this.repository.Add(announcement)); }