/// <inheritdoc />
        /// <exception cref="EventNotFoundException">Thrown if the event was not found</exception>
        public async Task Update(UpdateEventBody updateEventBody)
        {
            var e = await ApplicationContext.Events.Include(x => x.EventCategories)
                    .FirstOrDefaultAsync(x => x.Id == updateEventBody.Id);

            if (e == null)
            {
                Logger.LogInformation("Event not fond");
                throw new EventNotFoundException();
            }

            e.Name        = updateEventBody.Name;
            e.Description = updateEventBody.Description;
            e.Price       = updateEventBody.Price;
            e.IsOnline    = updateEventBody.IsOnline;
            e.Images      = updateEventBody.SocialLinks != null
                ? updateEventBody.Images.Select(x => Mapper.Map <Image>(x)).ToList()
                : null;

            e.Thumbnail = updateEventBody.Thumbnail != null
                ? Mapper.Map <Image>(updateEventBody.Thumbnail)
                : new Image();

            e.SocialLinks = updateEventBody.SocialLinks != null
                ? updateEventBody.SocialLinks.Select(x => Mapper.Map <SocialLink>(x)).ToList()
                : new List <SocialLink>();

            e.StartLocal      = updateEventBody.StartLocal;
            e.EndLocal        = updateEventBody.EndLocal;
            e.StartUTC        = updateEventBody.StartLocal.ToUniversalTime();
            e.EndUTC          = updateEventBody.EndLocal.ToUniversalTime();
            e.Address         = updateEventBody.Address;
            e.EventCategories = updateEventBody.Categories != null
                ? updateEventBody.Categories.Select(c => new EventCategory()
            {
                CategoryId = c.Id
            }).ToList()
                : new List <EventCategory>();

            e.Finished = updateEventBody.Finished;

            try
            {
                await ApplicationContext.SaveChangesAsync();

                Logger.LogInformation("Event updated");
            }
            catch
            {
                Logger.LogWarning("User failed to save");
                throw;
            }
        }
        public async Task <ActionResult> Update(UpdateEventBody updateEventBody)
        {
            try
            {
                Logger.LogInformation("Updating {Id}", updateEventBody.Id);
                await EventService.Update(updateEventBody);

                return(Ok());
            }
            catch (Exception e)
            {
                Logger.LogInformation(e.ToString());
                return(BadRequest(e));
            }
        }