protected override IServiceRequestOptionDto Create(int performingUserId, IServiceRequestOptionDto entity) { using (var context = new PrometheusContext()) { var serviceOption = context.ServiceRequestOptions.Find(entity.Id); if (serviceOption != null) { throw new InvalidOperationException(string.Format("Service Request Option with ID {0} already exists.", entity.Id)); } var savedOption = context.ServiceRequestOptions.Add(ManualMapper.MapDtoToServiceRequestOption(entity)); context.SaveChanges(performingUserId); return(ManualMapper.MapServiceRequestOptionToDto(savedOption)); } }