public ProjectService ImportProjectService(Guid organizationId, Guid projectId, Guid organizationCMSId, string agentId,
                                                   string name, string repositoryName, string description, Guid projectServiceTemplateId, PipeType pipeType, string branchName, string branchUrl, string projectExternaId, string projectExternalName)
        {
            Organization organization = FindOrganizationById(organizationId);

            if (organization == null)
            {
                throw new ApplicationException($"The organization with id {organizationId} does not exists");
            }

            Project project = organization.GetProjectById(projectId);

            if (project == null)
            {
                throw new ApplicationException($"The project with id {projectId} does not exists");
            }

            var newService = ProjectService.Factory.Create(name, repositoryName, description, projectServiceTemplateId, pipeType, projectId, organizationCMSId, project.AgentPoolId, this.Id);

            newService.IsImported                      = true;
            newService.BranchName                      = branchName;
            newService.ProjectExternalName             = projectExternalName;
            newService.ProjectExternalId               = projectExternaId;
            newService.ProjectBranchServiceExternalUrl = branchUrl;

            project.AddService(newService);

            return(newService);
        }
        public ProjectService CreateProjectService(Guid organizationId, Guid projectId, Guid organizationCMSId, string agentPoolId, string name, string repositoryName, string description, Guid projectServiceTemplateId, PipeType pipeType)
        {
            Organization organization = FindOrganizationById(organizationId);

            if (organization == null)
            {
                throw new ApplicationException($"The organization with id {organizationId} does not exists");
            }

            Project project = organization.GetProjectById(projectId);

            if (project == null)
            {
                throw new ApplicationException($"The project with id {projectId} does not exists");
            }

            var newService = ProjectService.Factory.Create(name, repositoryName, description, projectServiceTemplateId, pipeType, projectId, organizationCMSId, agentPoolId, this.Id);

            project.AddService(newService);

            return(newService);
        }