/// <summary>
        /// Gathers a list of Environments of a Lifecycle
        /// </summary>
        /// <param name="octRepository">The repository to call against.</param>
        /// <param name="lifecycle">Lifecycle to gather from.</param>
        /// <param name="phaseName">Phase name to gather from</param>
        /// <returns>Enumerable of EnvironmentResources</returns>
        public static IEnumerable <EnvironmentResource> GetLifeCyclePhaseEnvironments(OctopusRepository octRepository, LifecycleResource lifecycle, string phaseName)
        {
            var environmentList = new List <EnvironmentResource>();
            var lifecylePhase   = LifecycleHelper.GetPhaseByName(lifecycle, phaseName);

            return(GetPhaseEnvironments(octRepository, lifecylePhase));
        }
        /// <summary>
        /// Creates a Project
        /// </summary>
        /// <param name="octRepository">The repository to call against.</param>
        /// <param name="projectName">The project to create.</param>
        /// <param name="projectGroupName">The name of the project group to add the project to</param>
        /// <param name="lifecycleName">The name of the lifecycle to add to the project.</param>
        /// <returns>ProjectResource</returns>
        public static ProjectResource CreateProject(OctopusRepository octRepository, string projectName, string projectGroupName, string lifecycleName)
        {
            var projectGroup = ProjectGroupHelper.GetProjectGroupByName(octRepository, projectGroupName);
            var lifecycle    = LifecycleHelper.GetLifecycleByName(octRepository, lifecycleName);
            var newProject   = new ProjectResource()
            {
                Name           = projectName,
                ProjectGroupId = projectGroup.Id,
                LifecycleId    = lifecycle.Id
            };

            return(octRepository.Projects.Create(newProject));
        }
        /// <summary>
        /// Gathers a list Environments of a Project.
        /// </summary>
        /// <param name="octRepository">The repository to call against.</param>
        /// <param name="project">Project to gather from.</param>
        /// <param name="phaseName">name of the phase to gather.</param>
        /// <returns>Enumerable of EnvironmentResources</returns>
        public static IEnumerable <EnvironmentResource> GetProjectEnvironments(OctopusRepository octRepository, ProjectResource project, string phaseName)
        {
            var lifecycle = LifecycleHelper.GetProjectLifeCycle(octRepository, project);

            return(GetLifeCyclePhaseEnvironments(octRepository, lifecycle, phaseName));
        }