public Follow CreateFollow(int dashId, int id) { InitNonExistingRepo(true); dataMgr = new DataManager(uowManager); bool UoW = false; repo.SetUnitofWork(UoW); try { Follow follow = new Follow() { DashItem = repo.ReadDashItem(dashId), Onderwerp = dataMgr.GetPersoon(id) }; if (follow.Onderwerp != null) { repo.AddFollow(follow); uowManager.Save(); UoW = true; repo.SetUnitofWork(UoW); return(follow); } } catch { } try { Follow follow = new Follow() { DashItem = repo.ReadDashItem(dashId), Onderwerp = dataMgr.GetOrganisatie(id) }; if (follow.Onderwerp != null) { repo.AddFollow(follow); uowManager.Save(); UoW = true; repo.SetUnitofWork(UoW); return(follow); } } catch { } try { Follow follow = new Follow() { DashItem = repo.ReadDashItem(dashId), Onderwerp = dataMgr.GetThema(id) }; if (follow.Onderwerp != null) { repo.AddFollow(follow); uowManager.Save(); UoW = true; repo.SetUnitofWork(UoW); return(follow); } } catch { } throw new Exception("Follow werd niet correct geïnitialiseerd"); }