|  | @@ -31,7 +31,39 @@ namespace Comal.Stores
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              StoreUtils.Geocode(entity.SiteAddress);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void AfterSave(Job entity)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            base.AfterSave(entity);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(entity.HasOriginalValue(x => x.ID))
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                CreateDefaultScope(entity);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void CreateDefaultScope(Job job)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            var scope = new JobScope
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                Description = "Default Scope",
 | 
	
		
			
				|  |  | +                Type = JobScopeType.Contract
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            scope.Job.ID = job.ID;
 | 
	
		
			
				|  |  | +            FindSubStore<JobScope>().Save(scope, "Created automatically on job creation.");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            // Save the job again, with a default scope set. We create a lighter job so we're not saving all the same properties over again.
 | 
	
		
			
				|  |  | +            var lightJob = new Job
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                ID = job.ID
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            lightJob.DefaultScope.ID = scope.ID;
 | 
	
		
			
				|  |  | +            Provider.Save(lightJob);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            // Update default scope for sending the entity back to the client.
 | 
	
		
			
				|  |  | +            job.DefaultScope.ID = scope.ID;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          protected override void AfterDelete(Job entity)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              base.AfterDelete(entity);
 |