public RepositoryResult DeletePlant(RESTPlantDeleteModel plantModel)
        {
            var result = new RepositoryResult();

            try
            {
                var plants = plantDb.GetCollection <PlantModel>("plant");
                var plant  = plants.Find(p => p.Id == plantModel.Id).FirstOrDefault();

                if (plant == null)
                {
                    result.Successful = false;
                    result.Payload    = "Plant with ID " + plantModel.Id + " does not exist.";
                }
                else
                {
                    if (plant.Owner == plantModel.Username)
                    {
                        var user = userRepository.GetUserByName(plantModel.Username);

                        if (user == null)
                        {
                            result.Successful = false;
                            result.Payload    = "Could not find user: "******"Successfully deleted plant";
                                plants.DeleteOne(p => p.Id == plantModel.Id);
                            }
                            else
                            {
                                result.Successful = false;
                                result.Payload    = "Wrong password!";
                            }
                        }
                    }
                    else
                    {
                        result.Successful = false;
                        result.Payload    = "The user " + plantModel.Username + " does not own this plant.";
                    }
                }
            }
            catch (Exception e)
            {
                result.Successful = false;
                result.Payload    = "Error while deleting plant: " + e.Message;
            }

            return(result);
        }
        public ActionResult DeletePlant([FromBody] RESTPlantDeleteModel plantModel)
        {
            var result = plantRepository.DeletePlant(plantModel);

            if (result.Successful)
            {
                return(this.Ok(result));
            }

            return(this.BadRequest(result));
        }