public BuildPurgeRule CreateSystemBuildPurgeRule(int? buildRetentionMinutes, List<string> environmentNameList, List<string> environmentIdList, List<string> machineNameList, List<string> machineIdList)
 {
     var item = new BuildPurgeRule
     {
         Id = Guid.NewGuid().ToString(),
         ProjectId = null,
         BuildRetentionMinutes = buildRetentionMinutes,
         EnvironmentIdList = new List<string>(environmentIdList),
         EnvironmentNameList = new List<string>(environmentNameList),
         MachineIdList = new List<string>(machineIdList),
         MachineNameList = new List<string>(machineNameList),
         CreatedByUserName = _userIdentity.UserName,
         CreatedDateTimeUtc = DateTime.UtcNow, 
         UpdatedByUserName = _userIdentity.UserName,
         UpdatedDateTimeUtc = DateTime.UtcNow
     };
     return _documentSession.StoreSaveEvict(item);
 }
 public BuildPurgeRule CreateProjectBuildPurgeRule(string projectId, int? buildRetentionMinutes, List<string> environmentNameList, List<string> environmentIdList, List<string> machineNameList, List<string> machineIdList)
 {
     if(string.IsNullOrEmpty(projectId))
     {
         throw new ArgumentNullException("Missing project ID");
     }
     var item = new BuildPurgeRule
     {
         Id = Guid.NewGuid().ToString(),
         ProjectId = projectId,
         BuildRetentionMinutes = buildRetentionMinutes,
         EnvironmentIdList = new List<string>(environmentIdList),
         EnvironmentNameList = new List<string>(environmentNameList),
         MachineIdList = new List<string>(machineIdList),
         MachineNameList = new List<string>(machineNameList),
         CreatedDateTimeUtc = DateTime.UtcNow,
         CreatedByUserName = _userIdentity.UserName,
         UpdatedDateTimeUtc = DateTime.UtcNow,
         UpdatedByUserName = _userIdentity.UserName 
     };
     return _documentSession.StoreSaveEvict(item);
 }