public static BL.CounterAction MapMvcToBusiness(MVC.CounterAction source)
        {
            if(source == null)
                    return null;
                BL.CounterAction target = BL.CounterAction.GetOrCreate(MapSupport.ActiveCtx, source.CounterActionId);
                if(target.Version != Guid.Empty && target.Version != source.CounterActionVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.CounterActionIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.CounterActionVersion;
                target.Text = source.CounterActionText;

                }
                return target;
        }
        public static BL.InterestGroup MapMvcToBusiness(MVC.InterestGroup source)
        {
            if(source == null)
                    return null;
                BL.InterestGroup target = BL.InterestGroup.GetOrCreate(MapSupport.ActiveCtx, source.InterestGroupId);
                if(target.Version != Guid.Empty && target.Version != source.InterestGroupVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.InterestGroupIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.InterestGroupVersion;
                target.Name = source.InterestGroupName;

                }
                return target;
        }
        public static BL.ProjectStatusInfo MapMvcToBusiness(MVC.ProjectStatusInfo source)
        {
            if(source == null)
                    return null;
                BL.ProjectStatusInfo target = BL.ProjectStatusInfo.GetOrCreate(MapSupport.ActiveCtx, source.ProjectStatusInfoId);
                if(target.Version != Guid.Empty && target.Version != source.ProjectStatusInfoVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.ProjectStatusInfoIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.ProjectStatusInfoVersion;
                target.Owner = source.ProjectStatusInfoOwner;
                target.Updated = source.ProjectStatusInfoUpdated;
                target.Goal = source.ProjectStatusInfoGoal;
                            target.Measurements = MapProjectMeasurement.MapMvcToBusinessList(source.Measurements);
                    target.Actions = MapProjectAction.MapMvcToBusinessList(source.Actions);
                    target.InterestGroups = MapInterestGroup.MapMvcToBusinessList(source.InterestGroups);
                    target.Results = MapProjectResult.MapMvcToBusinessList(source.Results);
                    target.ChallengesAndExceptions = MapProjectChallenge.MapMvcToBusinessList(source.ChallengesAndExceptions);
                    target.CounterActions = MapCounterAction.MapMvcToBusinessList(source.CounterActions);

                }
                return target;
        }
        public static BL.ProjectMeasurement MapMvcToBusiness(MVC.ProjectMeasurement source)
        {
            if(source == null)
                    return null;
                BL.ProjectMeasurement target = BL.ProjectMeasurement.GetOrCreate(MapSupport.ActiveCtx, source.ProjectMeasurementId);
                if(target.Version != Guid.Empty && target.Version != source.ProjectMeasurementVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.ProjectMeasurementIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.ProjectMeasurementVersion;
                target.Text = source.ProjectMeasurementText;
                target.Status = source.ProjectMeasurementStatus;

                }
                return target;
        }
        public static BL.ProjectInfo MapMvcToBusiness(MVC.ProjectInfo source)
        {
            if(source == null)
                    return null;
                BL.ProjectInfo target = BL.ProjectInfo.GetOrCreate(MapSupport.ActiveCtx, source.ProjectInfoId);
                if(target.Version != Guid.Empty && target.Version != source.ProjectInfoVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.ProjectInfoIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.ProjectInfoVersion;
                target.Name = source.ProjectInfoName;
                target.ResponsibleUnitName = source.ProjectInfoResponsibleUnitName;
                target.ResponsiblePersonName = source.ProjectInfoResponsiblePersonName;
                target.FocusedYear = source.ProjectInfoFocusedYear;
                target.FocusedYearBudgetEuros = source.ProjectInfoFocusedYearBudgetEuros;
                target.FocusedYearEstimateEuros = source.ProjectInfoFocusedYearEstimateEuros;
                target.CommittedBudgetForNextYear = source.ProjectInfoCommittedBudgetForNextYear;
                target.WholeDurationRange = source.ProjectInfoWholeDurationRange;

                }
                return target;
        }
        public static BL.ProjectChallenge MapMvcToBusiness(MVC.ProjectChallenge source)
        {
            if(source == null)
                    return null;
                BL.ProjectChallenge target = BL.ProjectChallenge.GetOrCreate(MapSupport.ActiveCtx, source.ProjectChallengeId);
                if(target.Version != Guid.Empty && target.Version != source.ProjectChallengeVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.ProjectChallengeIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.ProjectChallengeVersion;
                target.Text = source.ProjectChallengeText;

                }
                return target;
        }
        public static BL.Project MapMvcToBusiness(MVC.Project source)
        {
            if(source == null)
                    return null;
                BL.Project target = BL.Project.GetOrCreate(MapSupport.ActiveCtx, source.ProjectId);
                if(target.Version != Guid.Empty && target.Version != source.ProjectVersion)
                {
                    throw new DataException("Concurrency check failed");
                }
                if(source.ProjectIsDeleted)
                {
                    target.Delete(MapSupport.ActiveCtx);
                    return null;
                } else {
                    target.Version = source.ProjectVersion;
                target.Name = source.ProjectName;
                target.StatusTrackingUrl = source.ProjectStatusTrackingUrl;
                target.TrackingUpdateTime = source.ProjectTrackingUpdateTime;
                target.StatusData = source.ProjectStatusData;
                            target.ProjectInfo = MapProjectInfo.MapMvcToBusiness(source.ProjectInfo);
                    target.ProjectStatusInfo = MapProjectStatusInfo.MapMvcToBusiness(source.ProjectStatusInfo);

                }
                return target;
        }