public int DeleteContributor(ContributorModel contributorInstance)
        {
            var id = contributorInstance.Id;

            if (id != 0)
            {
                lock (collisionLock)
                {
                    database.Delete <ContributorModel>(id);
                }
            }
            this.Contributors.Remove(contributorInstance);
            return(id);
        }
        //Update button to modify contributor details.
        public void Update_Clicked(object sender, EventArgs e)
        {
            ContributorModel Contributors = (ContributorModel)(((BindableObject)sender).BindingContext);

            if (Contributors == null || Contributors.Id < 1)
            {
                Console.WriteLine("Save data: ");
                dataAccess.SaveContributor(Contributors);
                dataAccess.AddNewContributor();
            }
            else
            {
                dataAccess.SaveContributor(Contributors);
            }
        }
        //Delete button to delete a contributor.
        public void Delete_Clicked(object sender, EventArgs e)
        {
            ContributorModel Contributors = (ContributorModel)(((BindableObject)sender).BindingContext);

            if (id != 0)
            {
                Console.WriteLine("Delete data: ");
                dataAccess.DeleteContributor(Contributors);
                dataAccess.DeleteContributor();
            }
            else
            {
                dataAccess.DeleteContributor(Contributors);
            }
        }
 public int SaveContributor(ContributorModel contributorInstane)
 {
     lock (collisionLock)
     {
         if (contributorInstane.Id != 0)
         {
             database.Update(contributorInstane);
             return(contributorInstane.Id);
         }
         else
         {
             database.Insert(contributorInstane);
             return(contributorInstane.Id);
         }
     }
 }