protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var data = Intent.GetStringExtra("data");

            appPreferences = new AppPreferences(Application.Context);
            var item = Newtonsoft.Json.JsonConvert.DeserializeObject <Facility>(data);

            viewModel = new FacilityDetailViewModel(item);

            Bundle mybundle = new Bundle();

            mybundle.PutString("data", Newtonsoft.Json.JsonConvert.SerializeObject(item));

            adapter = new TabsAdapter(this, SupportFragmentManager, mybundle);
            pager   = FindViewById <ViewPager>(Resource.Id.viewpager);
            var tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            pager.Adapter = adapter;
            tabs.SetupWithViewPager(pager);
            pager.OffscreenPageLimit = 3;

            Toolbar.MenuItemClick += (sender, e) =>
            {
                var itemTitle = e.Item.TitleFormatted;
                switch (itemTitle.ToString())
                {
                case "Log Out":
                    var intent = new Intent(this, typeof(LoginActivity));
                    appPreferences.SaveUserId("0");
                    StartActivity(intent);
                    break;

                case "Submit":
                    FacilityInformationFragment fragment = (FacilityInformationFragment)SupportFragmentManager.Fragments[1];
                    if (fragment != null)
                    {
                        fragment.SubmitFacility();
                    }
                    break;

                case "Add":
                    var buildingIntent = new Intent(this, typeof(AddBuildingActivity));;
                    StartActivity(buildingIntent);
                    break;
                }
            };

            pager.PageSelected += (sender, args) =>
            {
                var fragment = adapter.InstantiateItem(pager, args.Position) as IFragmentVisible;

                fragment?.BecameVisible();
            };

            SupportActionBar.Title = item.Name;
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
        }
            public override Android.Support.V4.App.Fragment GetItem(int position)
            {
                switch (position)
                {
                case 0: return(FacilityInformationFragment.NewInstance(newbundle));

                case 1: return(FacilityBuildingFragment.NewInstance());
                }
                return(null);
            }