/// <summary>
        /// Template provider class used for implementing specific queries here
        /// Use the DatabaseProvider class to execute queries
        /// It uses by default the table with the same name as the Entity
        /// </summary>

        public Entity Delete(int id)
        {
            /// <summary>
            /// Creates the query for deleting an item by EntityId and executing it with DatabaseProvider
            /// </summary>

            var deletedEntity = GetById(id);

            string query = @"
                            DELETE
                            FROM dbo.Entity
                            WHERE EntityId = @id
                            ";

            /// <summary>
            /// parameters variable initializes all the variables used by the query
            /// </summary>
            var parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@id", id));

            DatabaseProvider.ExecuteQuery(query, parameters);

            return(deletedEntity);
        }
        public int Update(Entity updatedEntity)
        {
            /// <summary>
            /// Query for updating an Entity
            /// Returns the id of the Entity
            /// </summary>
            string query = @"
                            UPDATE dbo.Entity
                            SET Name = @Name
                            WHERE EntityId = @Id
                            ";

            /// <summary>
            /// parameters variable initializes all the variables used by the query
            /// </summary>
            var parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@Name", updatedEntity.Name));
            parameters.Add(new SqlParameter("@Id", updatedEntity.EntityId));

            var result = DatabaseProvider.ExecuteQuery(query, parameters);

            return(updatedEntity.EntityId);
        }