private async Task createEmployee()
        {
            ErrorHandler error = new ErrorHandler(this);
            if (!Validate())
            {
                return;
            }

            try
            {
                int EmployeeID = int.Parse(EditTextEmployeeID.Text);
                string fullName = EditTextFirstName.Text + " " + EditTextLastName.Text;
                string Email = EditTextEmail.Text;
                string Department = SpinnerDepartment.SelectedItem.ToString();
                string Privledege = SpinnerPrivledge.SelectedItem.ToString();
                bool validID = await validateEmployeeID(EmployeeID);
                if (validID)
                {
                    var progressDialog = ProgressDialog.Show(this, "Please wait...", "Creating Employee...", true);
                    new Thread(new ThreadStart(async delegate
                    {
                        await IoC.EmployeeFactory.createEmployee(fullName, Email, EmployeeID, Department, Privledege);
                        var intent = new Intent(this, typeof(RecentEventsActivity));
                        StartActivity(intent);
                        RunOnUiThread(() => progressDialog.Hide());
                    })).Start();
                }
                else
                {
                    error.CreateAndShowDialog("EmployeeID is already used.", "Invalid EmployeeID");
                }
            }
            catch (Java.Net.MalformedURLException)
            {
                System.Diagnostics.Debug.WriteLine("There was an error creating the Mobile Service. Verify the URL");
            }
            catch (MobileServicePushFailedException ex)
            {
                error.CreateAndShowDialog("Internet connection required for Event creation.", "Connection Failed");
            }
            catch (Java.Net.UnknownHostException ex)
            {

                error.CreateAndShowDialog("Internet connection required for Event creation.", "Connection Failed");
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Login);

            error = new ErrorHandler(this);

            loginButton = FindViewById<Button>(Resource.Id.loginBtn);
            EditTextEmployeeID = FindViewById<EditText>(Resource.Id.userName);
            EditTextPassword = FindViewById<EditText>(Resource.Id.password);
            createUserButton = FindViewById<Button>(Resource.Id.createUserBtn);

            createUserButton.Click += (sender, e) =>
            {
                ValidateCreateUser();
            };
            loginButton.Click += (sender, e) =>
            {
                Login();
            };

        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            await IoC.UserInfo.setEmployee();
            // Set our view from the "main" layout resource
            await IoC.UserInfo.setEmployee();
            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.RecentEvents_Admin);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_Admin);
                        recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_Admin);
                        break;
                    }                    
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.RecentEvents_Moderator);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_Moderator);
                        recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_Moderator);
                        break;
                    }                    
                default:
                    {
                        SetContentView(Resource.Layout.RecentEvents_User);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_User);
                        recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_User);
                        break;
                    }
            }

                


            mRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView);


            _supporttoolbar = FindViewById<Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.recent_events, this);

            error = new ErrorHandler(this);

            if (IsPlayServicesAvailable())
            {
                var intentRegistration = new Intent(this, typeof(RegistrationIntentService));
                StartService(intentRegistration);
            }

            await RefreshView();
            FindViewById(Resource.Id.loadingPanel).Visibility = ViewStates.Gone;


            myEventList = recipientListItemAdapter.getEventsByEmployeeID(IoC.UserInfo.EmployeeID, eventItemAdapter);
            myEventList = filterEvents();

            sortByDate(myEventList);
            //Plug in the linear layout manager
            mLayoutManager = new LinearLayoutManager(this);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            //Plug in my adapter
            myEventListAdapter = new EventListAdapter(myEventList);
            myEventListAdapter.ItemClick += OnItemClick;
            mRecyclerView.SetAdapter(myEventListAdapter);

        }
        public void setupToolbar(Toolbar _supporttoolbar, DrawerLayout _drawer, NavigationView _navigationview, int titleID, AppCompatActivity context)
        {
            ViewContext = context;
            _supporttoolbar.SetTitle(titleID);
            context.SetSupportActionBar(_supporttoolbar);
            _supporttoolbar.SetNavigationIcon(Resource.Drawable.ic_menu_white_24dp);

            context.SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            ErrorHandler error = new ErrorHandler(context);
            _navigationview.NavigationItemSelected += (sender, e) =>
            
            {
                switch (e.MenuItem.ItemId)
                {
                    case Resource.Id.nav_recentEvents:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            var intent = new Intent(context, typeof(RecentEventsActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_createEvent:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            var intent = new Intent(context, typeof(EventCreationActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_deleteEvent:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to calendar view
                            var intent = new Intent(context, typeof(EventDeletionActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_calendar:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to calendar view
                            var intent = new Intent(context, typeof(CalendarViewActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_createEmployee:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to createEmployee view
                            var intent = new Intent(context, typeof(CreateEmployeeActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_overtime:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            //switch to overtime view
                            var intent = new Intent(context, typeof(OvertimeActivity));
                            context.StartActivity(intent);
                        }
                        break;
                    case Resource.Id.nav_filter:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            spawnFilterDialog();
                        }
                        break;
                    case Resource.Id.logoutitem:
                        {
                            _drawer.CloseDrawer(GravityCompat.Start);
                            OnLogoutClicked();
                            var intent = new Intent(context, typeof(LoginActivity));
                            context.StartActivity(intent);
                        }
                        break;

                }
            };
        }