public static DataCollection MapFrom(this DataCollection entity, DataCollectionViewModelStep1 vm)
        {
            if (vm == null || entity == null)
                return entity;

            string[] exclusions = entity.IsFirstCollection ? new[] {"DataStoreLocationName", "DataStoreLocationUrl", "IsFirstCollection"} : new string[] {};
            var injection = new SameNameWithRecursion(exclusions);
            entity.InjectFrom(injection, vm);
            return entity;
        }
        public void Update_DataCollection_for_step1()
        {
            var project = SetUpFullProjectWithAuthentication();
            var dataCollection = SetUpFullDataCollection(project);
            var vm = new DataCollectionViewModelStep1
                         {
                             AvailabilityDate = DateTime.Today.AddYears(1),
                             AwareOfEthics = true,
                             DataLicensingRights = PickHelper.RandomEnumExcept(dataCollection.DataLicensingRights),
                             EndDate = DateTime.Today.AddYears(1),
                             Id = dataCollection.Id,
                             ProjectId = project.Id,
                             ProjectTitle = project.Title,
                             ResearchDataDescription = "Research notitia genus",
                             ShareAccess = PickHelper.RandomEnumExcept(dataCollection.ShareAccess,ShareAccess.NoAccess),
                             ShareAccessDescription = "Partis obvius genus",
                             Title = "Notitia Contraho Titulus",
                             StartDate = DateTime.Today.AddYears(-1),
                             Type = PickHelper.RandomEnumExcept(dataCollection.Type),
                             DataCollectionIdentifier = PickHelper.RandomEnumExcept(DataCollectionIdentifier.None, dataCollection.DataCollectionIdentifier),
                             DataCollectionIdentifierValue = "notitia contraho identifier pendo",
                             DataStoreAdditionalDetails = "notitia repono additional retineo",
                             DataStoreLocationName = "Project Storage Space",
                             DataStoreLocationUrl = "http://www.test.edu.au/datastore/ABCDEF/",
                             IsFirstCollection = true
                         };

            _controller.WithCallTo(c => c.Step1(vm))
                .ShouldRedirectTo(_controller.GetType().GetMethod("Step2",new[]{typeof(int),typeof(int)}));

            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.AvailabilityDate == vm.AvailabilityDate));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.AwareOfEthics == vm.AwareOfEthics));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.EthicsApprovalNumber == vm.EthicsApprovalNumber));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.CurrentState.State == DataCollectionStatus.Draft));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataLicensingRights == vm.DataLicensingRights));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.EndDate == vm.EndDate));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.Id == vm.Id));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.ProjectId == vm.ProjectId));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.ResearchDataDescription == vm.ResearchDataDescription));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.ShareAccess == vm.ShareAccess));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.ShareAccessDescription == vm.ShareAccessDescription));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.Title == vm.Title));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.Type == vm.Type));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataCollectionIdentifier == vm.DataCollectionIdentifier));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataCollectionIdentifierValue == vm.DataCollectionIdentifierValue));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataStoreAdditionalDetails == vm.DataStoreAdditionalDetails));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataStoreLocationName != vm.DataStoreLocationName));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataStoreLocationUrl != vm.DataStoreLocationUrl));

            _dataCollectionRepository.ClearReceivedCalls();
            vm.AwareOfEthics = false;
            _controller.WithCallTo(c => c.Step1(vm))
               .ShouldRedirectTo(_controller.GetType().GetMethod("Step2", new[] { typeof(int), typeof(int) }));

            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.AwareOfEthics == false)); 
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.EthicsApprovalNumber == null));

            _dataCollectionRepository.ClearReceivedCalls();

            dataCollection.IsFirstCollection = false;
            _controller.WithCallTo(c => c.Step1(vm))
                .ShouldRedirectTo(_controller.GetType().GetMethod("Step2", new[] { typeof(int), typeof(int) }));

            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataStoreLocationName == vm.DataStoreLocationName));
            _dataCollectionRepository.Received().Save(Arg.Is<DataCollection>(o => o.DataStoreLocationUrl == vm.DataStoreLocationUrl));
            
        }