public async Task <IHttpActionResult> Edit(EventEditModel editModel) { if (!await _eventsService.CanEditAsync(editModel.Id)) { return(StatusCode(System.Net.HttpStatusCode.Forbidden)); } var cachedActivityMedias = _eventsService.Get(editModel.Id).MediaIds; var activity = MapToEvent(editModel); _eventsService.Save(activity); _mediaHelper.DeleteMedia(cachedActivityMedias.Except(activity.MediaIds)); if (!_eventsService.IsActual(activity)) { return(BadRequest("Event is not actual'")); } if (editModel.NotifyAllSubscribers) { var notificationType = NotificationTypeEnum.EventUpdated; ((INotifyableService)_eventsService).Notify(activity.Id, notificationType); } _activityTagsHelper.ReplaceTags(activity.Id, editModel.TagIdsData); _reminderService.CreateIfNotExists(activity.Id, ReminderTypeEnum.OneDayBefore); ResolveMentions(editModel.Description, activity); var redirectUrl = _activityLinkService.GetLinks(activity.Id).Details; ReloadFeed(); return(Ok(redirectUrl)); }