/// <summary>
        /// Adds a replacement to the database
        /// </summary>
        /// <param name="replacement">The <see cref="ReplacementVM"/> to add to the database</param>
        /// <param name="path">The path to the database</param>
        /// <returns></returns>
        public static short AddReplacementToDB(ReplacementVM replacement, string path = DEFAULTPATH)
        {
            try
            {   // connect to the database
                using (SQLiteConnection con = new SQLiteConnection(path))
                {
                    // get the required tables of the database
                    con.CreateTable <ReplacementVM>();
                    var existingReplacement = con.Find <ReplacementVM>(replacement.Original);
                    if (existingReplacement == null)
                    {
                        con.Insert(replacement);
                    }
                    else
                    {
                        existingReplacement.Replaced = replacement.Replaced;
                        con.RunInTransaction(() =>
                        {
                            con.Update(existingReplacement);
                        });
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Log("AddReplacementToDB : " + ex);
                return(-1);
            }
        }
        public JsonResult CancelReplacement(ReplacementVM replacement)
        {
            var myContent   = JsonConvert.SerializeObject(replacement);
            var buffer      = System.Text.Encoding.UTF8.GetBytes(myContent);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var result = client.PutAsync("Replacement/CancelReplacement/" + replacement.Id, byteContent).Result;

            return(Json(result));
        }