protected override ISwotActivityDto Create(int performingUserId, ISwotActivityDto activityDto)
 {
     using (var context = new PrometheusContext())
     {
         var activity = context.SwotActivities.Find(activityDto.Id);
         if (activity != null)
         {
             throw new InvalidOperationException(string.Format("SWOT Activity with ID {0} already exists.", activityDto.Id));
         }
         var savedActivity = context.SwotActivities.Add(ManualMapper.MapDtoToSwotActivity(activityDto));
         context.SaveChanges(performingUserId);
         return(ManualMapper.MapSwotActivityToDto(savedActivity));
     }
 }
 protected override ISwotActivityDto Update(int performingUserId, ISwotActivityDto activityDto)
 {
     using (var context = new PrometheusContext())
     {
         if (!context.SwotActivities.Any(x => x.Id == activityDto.Id))
         {
             throw new InvalidOperationException(string.Format("SWOT Activity with ID {0} cannot be updated since it does not exist.", activityDto.Id));
         }
         var updatedActivity = ManualMapper.MapDtoToSwotActivity(activityDto);
         context.SwotActivities.Attach(updatedActivity);
         context.Entry(updatedActivity).State = EntityState.Modified;
         context.SaveChanges(performingUserId);
         return(ManualMapper.MapSwotActivityToDto(updatedActivity));
     }
 }