public ApplicationIdNotPartOfOrganisationException NewCollectionWithApplicationIdNotPartOfOrganisationId()
        {
            Organisation organisationThatIsNotTheOneForTheApplication = new Api().Resource<OrganisationResource>().NewOrganisation();

            ApplicationResource applicationResource = new Api().Resource<ApplicationResource>();
            var applicationWeWantToAddCollectionTo = applicationResource.NewApplication();
            var applicationIdForOneWeWantToAddCollectionTo = applicationWeWantToAddCollectionTo.Id;

            var organisationIdDifferentToApplicationWeWantToAddTo = organisationThatIsNotTheOneForTheApplication.Id;

            try
            {
                _collectionServiceAgent.Post(
                    new Collection
                        {
                            Name = "testNameForBadOrganisationId",
                            Active = true,
                            ApplicationId = applicationIdForOneWeWantToAddCollectionTo,
                            OrganisationId = organisationIdDifferentToApplicationWeWantToAddTo
                        });
            }
            catch (ApplicationIdNotPartOfOrganisationException exception)
            {
                return exception;
            }

            return null;
        }
        public BadRequestException NewCollectionWithUnspecifiedName()
        {
            ApplicationResource applicationResource = new Api().Resource<ApplicationResource>();
            var application = applicationResource.NewApplication();
            var applicationId = application.Id;
            var organisationId = application.OrganisationId;

            try
            {
                _collectionServiceAgent.Post(
                    new Collection
                    {
                        Active = true,
                        ApplicationId = applicationId,
                        OrganisationId = organisationId,
                    });
            }
            catch (BadRequestException ex)
            {
                return ex;
            }

            throw new SpecFlowException("Expected BadRequestException was not caught");
        }
        public Collection NewCollectionWithSpecifiedName(string name)
        {
            var applicationResource = new Api().Resource<ApplicationResource>();
            var newApplication = applicationResource.NewApplication();
            var applicationId = newApplication.Id;
            var organisationId = newApplication.OrganisationId;

            return NewCollectionWithSpecifiedNameAndApplicationIdAndOrganisationId(name, applicationId, organisationId);
        }
        public BadRequestException NewCollectionWithNoOrganisationId()
        {
            ApplicationResource applicationResource = new Api().Resource<ApplicationResource>();
            var application = applicationResource.NewApplication();
            var applicationId = application.Id;

            try
            {
                _collectionServiceAgent.Post(
                    new Collection
                    {
                        Name = "testNameForNoOrganisationId",
                        Active = true,
                        ApplicationId = applicationId,
                    });
            }
            catch (BadRequestException exception)
            {
                return exception;
            }

            throw new SpecFlowException("Expected BadRequestException was not caught");
        }
        public OrganisationIdNotValidException NewCollectionWithNonExistentOrganisationId()
        {
            ApplicationResource applicationResource = new Api().Resource<ApplicationResource>();
            var application = applicationResource.NewApplication();
            var applicationId = application.Id;

            try
            {
                _collectionServiceAgent.Post(
                    new Collection
                    {
                        Name = "testNameForNoOrganisationId",
                        Active = true,
                        ApplicationId = applicationId,
                        OrganisationId = applicationId + "xx"
                    });
            }
            catch (OrganisationIdNotValidException exception)
            {
                return exception;
            }

            return null;
        }
        public CollectionNameAlreadyExistsException NewCollectionWithExistingNameInApplication()
        {
            ApplicationResource applicationResource = new Api().Resource<ApplicationResource>();
            var application = applicationResource.NewApplication();
            var applicationId = application.Id;
            var organisationId = application.OrganisationId;

            string collectionNameToBeDuplicated = "testNameForCollection" + DateTime.UtcNow.ToString("yyyyMMddSSmm");
            _collectionServiceAgent.Post(
                new Collection
                    {
                        Name = collectionNameToBeDuplicated,
                        Active = true,
                        ApplicationId = applicationId,
                        OrganisationId = organisationId
                    });

            try
            {
                _collectionServiceAgent.Post(
                    new Collection
                    {
                        Name = collectionNameToBeDuplicated,
                        Active = true,
                        ApplicationId = applicationId,
                        OrganisationId = organisationId
                    });
            }
            catch (CollectionNameAlreadyExistsException exception)
            {
                return exception;
            }

            throw new SpecFlowException("Did not get expected CollectionNameAlreadyExistsException");
        }